I've been working on calling a global variable inside a function and have tried several ways as I've seen online including:
global $variable; // AND $localVariable = $GLOBALS['variable'];
What I'm trying to do is to use this variable as a condition for a for-loop in a function inside my script. I have tested and was able to use both methods above outside the function and was even able to call the global variable inside the function, change it's value and then echo that value from outside said function. My last try was:
$cnt=$GLOBALS['count']; $count = $cnt; for($a=0; $a<=$count; $a+=2)
Any help is appreciated.
Newbie to PHP