$GLOBALS['a'] = 'localhost';
function body(){
echo $GLOBALS['a'];
}
<?php
$myVariable = "a";
function changeVar($newVar) {
global $myVariable
$myVariable = "b";
}
echo $myVariable; // Should echo b
?>
$a = 1;
$b = 2;
function Sum(){
global $a, $b; // allows access to vars outside of function
$b = $a + $b;
}
Sum();
echo $b; // output is 3
$GLOBALS["foo"]
composer global require squizlabs/php_codesniffer