In this article, you will learn how to get the value from the variables having global scope.
examples of the GLOBAL function
Example 1. In this example, we use a global variable in a function.
<?php
$x = 5;
function add($y) {
global $x;
return $x + $y;
}
echo "$x + 5 is " . add(5);
?>