The global statement works just fine on my server in this code:
main1.php:
call1.php:
But global does not work in a much bigger, more complex program. I tried the global statement at the beginning of the bigger program and it still does not work. (Definitely not a typo).
What would keep global from working in one program but not another on the same server?
main1.php:
Code:
<?php
include "call1.php";
$a = 1;
$b = 2;
Sum();
echo $b;
?>
call1.php:
Code:
<?php
function Sum()
{
global $a, $b;
$b = $a + $b;
}
?>
But global does not work in a much bigger, more complex program. I tried the global statement at the beginning of the bigger program and it still does not work. (Definitely not a typo).
What would keep global from working in one program but not another on the same server?