I have this code:
$len = strlen($string);
if ($string{$len-1} == '-') {
// Do stuff...
}
However I get the following NOTICE error:
Uninitialized string offset: -1
When I var_dump($len-1)
the value I get:
int 3
When I var_dump($string)
I get:
string 'bobo' (length=4)
So could anyone tell me why this is causing a NOTICE error?