note 41140 added to function.array-shift
| From: | php-general at lists dot php dot net | Date: | Wed, 31 Mar 2004 13:48:53 +0000 |
| Subject: | note 41140 added to function.array-shift | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67418@lists.php.net to get a copy of this message | ||
>> it had me baffled for a while, but it is probably documented
>> somewhere as normal behaviour for array_shift :
>>
>> $vars = array('var1', 'var2', 'var3') ;
>> $vars = array_shift($vars) ;
>>
>> will return :
>>
>> var2, var3, var1
>>
>> and NOT :
>>
>> var2, var3
>> as I first thought ...
$vars = array_shift($vars) assignes the first removers the first element from $vars so that $vars ==
array('var2', 'var3').
Then what was the first element of $vars is asssigned to $vars so that $vars == 'var1'.
If your copy of PHP does something different then there is something wrong Frank.
----
Manual Page -- http://www.php.net/manual/en/function.array-shift.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41140
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41140&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41140&report=yes
Search -- http://master.php.net/manage/user-notes.php