$GLOBAL - Used to access global variables from anywhere in the PHP script


SUBMITTED BY: henry1874w

DATE: June 17, 2017, 1:17 p.m.

FORMAT: Text only

SIZE: 191 Bytes

HITS: 204

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <?php
  5. $x = 75;
  6. $y = 25;
  7. function addition() {
  8. $GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y'];
  9. }
  10. addition();
  11. echo $z;
  12. ?>
  13. </body>
  14. </html>

comments powered by Disqus