|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2015-07-18 10:00 UTC] cmb@php.net
-Package: PHP Language Specification
+Package: Arrays related
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 00:00:02 2025 UTC |
Description: ------------ Sometimes I want to use the list() construct to unpack an array, but I don't know the size of the array. In this case, list() will give me a "Notice: Undefined index ..". It would be nice if I could specify default values, as in the code below. Test script: --------------- <?php list($a, $b = 'bbb', $c = 'ccc') = array('AAA', 'BBB'); print "$a, $b, $c"; // Output: "AAA, BBB, ccc".