Aug 30, 2008 16:24
Did you know, dear friends, that PHP's eval() function fux0rz ur globalz?
Example!
daniel-frishbergs-computer:~ dfrishberg$ emacs test.php
daniel-frishbergs-computer:~ dfrishberg$ php test.php
daniel-frishbergs-computer:~ dfrishberg$
Nothing! It should have printed 3, but it did not. WTF, PHP. You've let me down.
EDIT: I was actually incorrect:
The $x here is locally scoped, so this code shouldn't print anything anyway. However, I have been running into problems with global using eval(). So still, PHP, WTF.
EDIT #2: I may be wrong about this entirely. I may update if I ascertain that the problem with usage of global and eval() is indeed the problem I had, or that it is not.