It works most of the time, since it will pass strings integer or double, but you have to be careful. It will work correctly for scalar values. However, if you do this:
x(new stdClass);
You will receive E_NOTICE . This is not so bad, is it? It:
x(array());
And you get the types E_ERROR , Unsupported operands, and the script ends.
You might think that this is not so bad, but a fatal error at the wrong time can leave your system in an unstable state, for example, losing link integrity or leaving an incomplete sequence of requests.
Only you know if a case like the one above can happen. But if this data comes from the user in any way, I would go with Murphy's law on this matter and not trust him.
source share