Hello If I'm not mistaken, this code should output 1 2 3 4 5 if x is equal to asc and 9 8 7 6 5 if x is not equal to asc.
<?php $x = 'asc'; function fun() { if($GLOBALS['x'] == 'asc') { static $counter = 0; $counter++; echo "$counter<br>"; } else { static $counter = 10; $counter--; echo "$counter<br>"; } } fun(); fun(); fun(); fun(); fun(); ?> But it displays 11 12 13 14 15 if x is equal to asc and 9 8 7 6 5 if x is not equal to asc. Why the condition does not work and in any case, the counter is set to 10?