'odd' handling of $moo['bar'] where $moo is a string
| From: | Ian P. Christian | Date: | Thu, 09 Feb 2006 21:54:01 +0000 |
| Subject: | 'odd' handling of $moo['bar'] where $moo is a string | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-21827@lists.php.net to get a copy of this message | ||
Can someone explain the following to me?
echo "DEBUG:\n";
var_dump($keys);
var_dump($keys['file']);
var_dump(isset($keys['NOTEXISTING']));
var_dump(isset($keys['file']));
exit;
DEBUG:
string(19) "myConsoleController"
string(1) "m"
bool(true)
bool(true)
Now, it seems that $keys['file'] == $keys[0], which makes sense why the issets
return true. However...
if ('file') echo 'true';
will print moo, therefore 'file' == 1, not 0. Why is this different when using
it as a string offset?
IMO, using a string as a string offset, a fatal error should be raised.
Kind Regards,
--
Ian P. Christian
http://pookey.co.uk