Tuesday, September 28, 2010

Php: Easy way for creating a Global Function.


Starting php script:


echo 'Lets make a global function';

function createglobal() {

global $my_global;
$my_global = 10;


}

$my_global = 5;

echo "The value of \$my_global is '$my_global'
";

createglobal();

echo "The value of \$my_global is '$my_global'
";



ending php script

Before the createglobal(); is called the value of variable stays to local value. Which is 5. But as soon as the function is called the value becomes to 10 which was defined in the createglobal function.

2 comments:

Published on YouTube: Just some casaul chess Black Left the Game wonder why?

Just some casaul chess Black Left the Game wonder why? Funny the way things worked out for white in the whole game. [Event "Rated Blit...