Undefined Variable

no-email (Damien Seguy), Damien Seguy
Fri, 22 Nov 2024 00:00:00 +0000

The variable is undefined, and yet this is reported on the actual line where the variable is defined!
In fact, the assignation to ``$x`` appears to be the definition of the variable, because we, as human, encounter it first while reading.
Upon close inspection, the variable is actually used in the call to the function ``foo``: PHP evaluates the arguments before calling the function, and finally, make the assignation. So the ``$x``, used as second parameter in the ``foo`` call, is actually the first usage of the variable ``$x``. Hence, the error message.