Re: [VOTE] Fix list() behavior inconsistency

From: Date: Fri, 26 Sep 2014 08:38:47 +0000
Subject: Re: [VOTE] Fix list() behavior inconsistency
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-77656@lists.php.net to get a copy of this message
It's an inconsistent undocumented behavior, that started to work not by design, but because of implementation issues. <?php list($a, $b) = "ab"; var_dump($a,$b); ?> NULL NULL By the way, I'm agree, keeping string support might be better for compatibility. Thanks. Dmitry. On Fri, Sep 26, 2014 at 11:16 AM, Stas Malyshev <smalyshev@sugarcrm.com> wrote: > Hi! > > > * Strings are _not_ treated as arrays of bytes everywhere. > > This is true. However, sometimes they are. E.g., $string[0] is > meaningful, while array_flip($string) is not. > > > * If we intend to give strings more array-like support after this RFC > > We don't intend to give strings anything - both $string[0] and list($a, > $b) = $string works right now. See here: http://3v4l.org/7AZFZ > > So you are arguing for BC break for no reason at all. > > > (like foreach($string as $char), making array_* work with strings), > > Nobody proposed that in this RFC, and it makes zero sense to propose it > in this RFC, as this RFC is about list(), not about making strings into > arrays which would require humongous amount of work and was not > requested by anybody. > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#77656) next »