Code has been added to clipboard!

Storing Global PHP Variables

Example
<?php
  $x = 20;
  $y = 10;

  function learnTest() {
    $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
  } 

  learnTest();
  echo $y; // outputs 30
?>