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


Smartphone icons created by Freepik - Flaticon

PHP $GLOBALS

100

<?php 
// assign values to variables $x and $y
$x = 75;
$y = 25; 

// add $x, $y and assign value to $z
function addition() {
  $GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y'];
}

// display value of $z
addition();
echo $z;
?>

In the example above, since z is a variable present within the $GLOBALS array, it is also accessible from outside the function!