$GLOBAL variable


$GLOBALS is a PHP super global variable which is used to access global variables from anywhere in the PHP script (also from within functions or methods).

Program for assigning $GLOBAL variable.
 <html>
 <body>
 <?php
 $a = 55;
 $b = 23;
 function sum()
 {
 $GLOBALS[‘s'] = $GLOBALS[‘a'] + $GLOBALS[‘b'];
 }
 sum();
 echo $s;
 ?>
 </body>
 </html>