It is — sort of — in both. It happens by programmers who are getting superstitious about what the actual type of a variable they have is, and `str()` it. Then they "know" what they're working with. (Alas, the string "None" or "null".)
Not even PHP (it took me about 10 minutes to remember how to PHP before I could test it to be sure).
What's the difference between yourself and a Wordpress plugin?
None, doing things in PHP makes you really insecure.