note 57719 added to function.array-shift
| From: | groups at 8legs dot co dot nz | Date: | Wed, 12 Oct 2005 08:29:09 +0000 |
| Subject: | note 57719 added to function.array-shift | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96889@lists.php.net to get a copy of this message | ||
As of version 5.0.5 it has been decreed that array_shift (and other methods that manipulate an
array, like: array_pop, array_push) can no longer accept a reference, only a value.
For example:
Until 5.0.5 this was perfectly acceptable:
$first_element = array_shift(functionThatReturnsAnArray());
now it would have to look a little like this:
$arbitrary_array = functionThatReturnsAnArray()
$first_element = array_shift($arbitrary_array);
or
$first_element = array_shift($arbitrary_array = functionThatReturnsAnArray());
The change apparently has something to do with possible memory corruption but that sounds like a cop
out to me. Fix the memory corruption if it's a problem, don't break a widely used and
hither-to perfectly legitimate piece of syntax, then foist it on an unsuspecting community in a
minor version change. Very unimpressed with the cavalier attitude regarding this issue.
----
Manual Page -- http://www.php.net/manual/en/function.array-shift.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57719
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57719&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57719&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57719&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57719&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57719&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57719&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57719&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57719&report=yes
Search -- http://master.php.net/manage/user-notes.php