PHP: Access Global Vars with global statement

Start PHP Code RESULT
The meaning of life is: 42

End PHP Code RESULT

 

The PHP Code START
<?php
$life = 42;
function meaningOfLife() {
    global $life;
    print "The meaning of life is: $life<br />";
}

meaningOfLife();
?>
The PHP Code END

Back to Bill's PHP