note 52802 deleted from function.list by bjori
| From: | bjori@php.net | Date: | Sat, 14 Apr 2007 09:53:45 +0000 |
| Subject: | note 52802 deleted from function.list by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125393@lists.php.net to get a copy of this message | ||
Note Submitter: php at keithtyler dot com
----
Note to perl programmers, this does NOT work like Perl's anonymous-list technique. It will
discard any elements on the right hand side that do not have a corresponding recipient value on the
left hand side.
In Perl, you can put an array at the end of the list, and it will pick up all remaining elements
from the right hand of the assignment.
($val1,$val2,@others)=array("a","b","c","d","e")
will result in $val1="a", $val2="b", and
@others=("c","d","e").
This cannot seem to be done in PHP, even if you declare the array beforehand:
$others=Array();
list($val1,$val2,$others)=array("a","b","c","d","e")
will result in $val1="a", $val2="b", and $others="c". Note also that
$others is redefined as whatever type the right-hand side value was, and is no longer an Array.
This is in 4.3.11.