Without wanting to sollicate the obvious Q&A, I'm wondering if anybody knows why the following happens.
I have a string variable $string with the value '1011100001111'
Testing for a '1' or '0' at a certain position:
$string[00] => '1' // correct
$string[01] => '0' // correct
$string[07] => '0' // correct
$string[08] => '1' // should be '0'
$string[ 8] => '0' // correct
It took me a while to find the error when using prefix zeroes, and obviously I got rid of them, but why is index 08 different from 8? Note that up to 07 it does work!
08, it uses the hex value of that number, not the decimal value. So it's not looking where you think it is.Parse error: Invalid numeric literal in...i.e.08is an invalid octal number