Re: Re: A little confusing thing on (mistakenly) geting a offset fromstring with multi dim index.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 14, 2014 at 10:06 PM, Christoph Becker <cmbecker69@xxxxxx>wrote:

> 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
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Trying different versions of php give different results:

http://sandbox.onlinephpfunctions.com/

$string = 'this is a string';
var_dump($string['check']);

var_dump(isset($string['check']));
var_dump(isset($string['check'][0]));

Biggest change from 5.3 -> 5.5

No idea why this is happening, like Chris said php internals might be a
good place to ask.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux