PHP: Function called with leading zero parameter gets zero inside
function, php, zero
Solution
Leading `0` conventionally indicates a number written in octal notation instead of decimal; `8` and `9` are not valid octal digits. (I admit to not knowing why PHP would care; it's not a conventional notation for web stuff.)
Problem
I created a php (5.2.6) function simple as is: file a.php: ``` function la ($n) { echo "$n"; } ``` file b.php: ``` include ('a.php'); // got many calls of function with leading zero in parameter la (01); la (02); ... la (07); la (08); la (09); la (10); ``` Sometimes it prints 1, 2... 9, 10, sometimes it prints 0 instead 8 or 9! Looks random. Why? Why only 8 or 9? Indeed, I can avoid this zero. But, since I found strange behaviour, I want to ask you: what is the secret of this weird behaviour? Or I am weird. Thank you.