Pffft... child's play.
That's the point, simple but powerful.
Pffft... child's play.
Wait, this has been deprecated?
Edit: This hasn't been deprecated. What has been deprecated is something like this:
Code:$x=5; $y=2; play_game($x, &$y); function play_game($x, $y) { $x = 9; $y = 4; }
Balance has been restored to the universe now that I don't have 40 hours rewriting all my code.
There's no real global variables in PHP (other than $GLOBALS array). For example, if I put "$z = 6" at the top of that code snippet, the play_game() function wouldn't be able to see to $z.
$z = 6;
function play_game()
{
global $z;
echo $z;
}
define("NUMBER", 1);
echo NUMBER;
The fuck... I've been coding a long time, circa 1995, thank god not in php, cause I don't see that shit working right here. Maybe you left some code out, or this is a troll - I don't know anymore.
Wait, this has been deprecated?
Edit: This hasn't been deprecated. What has been deprecated is something like this:
Balance has been restored to the universe now that I don't have 40 hours rewriting all my code.Code:$x=5; $y=2; play_game($x, &$y); function play_game($x, $y) { $x = 9; $y = 4; }
That code I posted? It works fine. I just tested it myself:
Code:$x=5; $y=2; echo "X = $x, Y = $y\n"; play_game($x, $y); echo "X = $x, Y = $y\n"; function play_game($x, &$y) { $x = 9; $y = 4; }
Run that, and the output will be:
Code:X = 5, Y = 2 X = 5, Y = 4
Or what PHP version are you using? Apparently, if it's v5.4+, it's not going to work. My devel server is v5.3.9.