Mega Code Archive

 
Categories / Php / Language Basics
 

Accessing Global Variables with the global Statement

<html> <head><title>The global Statement</title></head> <body> <div> <?php     $life=42;          function meaningOfLife() {       global $life;       print "The meaning of life is $life<br />";     }     meaningOfLife(); ?> </div> </body> </html>