Doc #65221 [NEW]: Does not adequately explain nature of how list retrieves values from an array
| From: | lucas at threeamdesign dot com | Date: | Tue, 09 Jul 2013 03:53:53 +0000 |
| Subject: | Doc #65221 [NEW]: Does not adequately explain nature of how list retrieves values from an array | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-10056@lists.php.net to get a copy of this message | ||
From: lucas at threeamdesign dot com
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Does not adequately explain nature of how list retrieves values from an array
Description:
------------
---
From manual page: http://www.php.net/function.list
---
The main description for the construct should specify that it only operates
on numeric indices of an array (i.e. string keys are ignored) and expects
them to be consecutive and starting at 0. It should also state that the
order in which the indices were defined is irrelevant.
Test script:
---------------
This behaviour could be explained clearly, like so:
<?php
$foo = array(2 => 'a', 'foo' => 'b', 0 => 'c');
$foo[1] = 'd';
list($x, $y, $z) = $foo;
var_dump($foo, $x, $y, $z);
?>
produces the following result:
array(4) {
[2]=>
string(1) "a"
["foo"]=>
string(1) "b"
[0]=>
string(1) "c"
[1]=>
string(1) "d"
}
string(1) "c"
string(1) "d"
string(1) "a"
--
Edit bug report at https://bugs.php.net/bug.php?id=65221&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65221&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65221&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65221&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65221&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65221&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65221&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65221&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65221&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65221&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65221&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=65221&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=65221&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65221&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65221&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65221&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65221&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65221&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65221&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65221&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65221&r=mysqlcfg