This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP The global Keyword

15

<?php
// declare global variables
$x = 5;
$y = 10;

// use global variables in function
function myTest() {
  $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
} 

myTest(); // run function
echo $y; // output the new value for variable $y
?>