php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74108 Function list() and []
Submitted: 2017-02-16 12:56 UTC Modified: 2017-02-16 15:39 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: namonexarap at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.1.1 OS: Windows 7 SP 1 32-bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: namonexarap at gmail dot com
New email:
PHP Version: OS:

 

 [2017-02-16 12:56 UTC] namonexarap at gmail dot com
Description:
------------
Why does it work in this case:
------------------------------
$money = array (0 => 11000, 1 => 5500, 2 => 1500);
[$D, $Ol, $Od] = $money;
echo $D;
------------------------------

But doesn`t work in this case:
------------------------------
$money = array (5 => 11000, 6 => 5500, 7 => 1500);
[$D, $Ol, $Od] = $money;
echo $D;
------------------------------

Test script:
---------------
$money = array (5 => 11000, 6 => 5500, 7 => 1500);
[$D, $Ol, $Od] = $money;
echo $D;

Expected result:
----------------
11000

Actual result:
--------------
null

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-16 15:39 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2017-02-16 15:39 UTC] requinix@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

http://php.net/manual/en/function.list.php
> Note:
> list() only works on numerical arrays and assumes the numerical indices start at 0.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 08:00:02 2026 UTC