Mega Code Archive

 
Categories / Php / Language Basics
 

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

<html> <head> <title>Variables Defined Outside Functions Are Inaccessible from Within a Function by Default</title> </head> <body> <?php $life = 42; function meaningOfLife(){      print "The meaning of life is $life<br>"; } meaningOfLife(); ?> </body> </html>