Re: A little confusing thing on (mistakenly) geting a offset fromstring with multi dim index.
| From: | Christoph Becker | Date: | Thu, 15 May 2014 02:06:29 +0000 |
| Subject: | Re: A little confusing thing on (mistakenly) geting a offset fromstring with multi dim index. | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323322@lists.php.net to get a copy of this message | ||
Rain Lee wrote:
> I think the convert that cause the 'key' become 0 is ... not a good
> idea. But my experience on PHP is so little, maybe there is some
> reason for it that i never know.
I have to agree that this behavior is somewhat unexpected. However, it
seems to fit well to PHP's type juggling, which generally takes getting
used to. And of course you can get around this behavior by making sure
you have an array and not a string; consider making use of type hinting[1].
> Don't know what's the opinion of those guys inside the PHP.
Me neither. You might consider filing a feature request[2] or asking on
php.internals[3].
[1] <http://www.php.net/manual/en/language.oop5.typehinting.php>
[2] <https://bugs.php.net/>
[3] <news://news.php.net/php.internals>
--
Christoph M. Becker