EDIT: so sorry, the original code was an iteration while i was trying to figure the problem out, I've edited the code This question started similar, but here's the real problem I'm having:
In this code:
<?php
$a = 2:
function incr(){
$a++;
echo $a;
}
echo $a;
incr();
?>
the output is 2 and then 1, and that signals to me that the variable $a
gets initialized to 0 inside the function. Does the server know just by the virtue that i used the increment syntax to initialize the variable to 0?