Accessing Global Variables with the global Statement : Global : Language Basics PHP Source Code


PHP Source Code » Language Basics » Global »

 

Accessing Global Variables with the global Statement



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

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Language Basics
» Global