Set new value into GLOBALS values : GLOBALS « Language Basics « PHP






Set new value into GLOBALS values


<?php
   $somevar = 15;
   function addit() {
      $GLOBALS["somevar"]++;
   }
   addit();
   print "Somevar is ".$GLOBALS["somevar"];
?>
           
       








Related examples in the same category

1.Looping Through the $GLOBALS Array
2.$GLOBALS with property
3.Accessing Global Variables with the global Statement
4.Create global variables
5.Modifying a Variable with $GLOBALS
6.Global vs function level
7.Overriding Scope with the GLOBALS Array