Mega Code Archive

 
Categories / Php / Functions
 

Variables Defined Outside Functions Are Inaccessible from Within a Function by Default

<html> <head> <title>No Default Access to Globals in Functions</title> </head> <body> <div> <?php     $life = 42;     function meaningOfLife() {       print "The meaning of life is $life<br />";     }     meaningOfLife(); ?> </div> </body> </html>