Re: Allow Iterator to be used with current, next, reset, key functions

From: Date: Sun, 30 Oct 2016 12:48:18 +0000
Subject: Re: Allow Iterator to be used with current, next, reset, key functions
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-96648@lists.php.net to get a copy of this message
On 10/30/2016 05:31 AM, Rasmus Schultz wrote:
On second thought, I agree with that - changing reset() and end() doesn't make sense, because people know them and expect them to work in a certain way. Likely a lot of people would actually continue to use them with intermediary variables the way they do today.
Today? In PHP 5.6.x I didn't have to use intermediate variables. Being required to use them was new with PHP 7 and I suspect you will find a lot of sites still using pre 7 because they haven't taken the time to make sure every app they run works in PHP 7. All my production servers still run 5.6.x for that reason, I'm only now starting to port the apps I can now that it appears the PECL modules I need have finally all been updated. The php apps I am fixing are currently littered with code like this: $SEVENFIX = explode('.', $rs[0]->cover); if(end($SEVENFIX) == "whatever") { // do stuff } before trying the app in my 7.1.0RCx test servers they worked just fine as if(end(explode('.', $rs[0]->cover)) == "whatever") { // do stuff } So I suppose some people might "continue" to use them with intermediary but a lot of code that hasn't been ported to 7 doesn't currently.

« previous php.internals (#96648) next »