php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27447 arrays value maybe not correct
Submitted: 2004-03-01 09:00 UTC Modified: 2004-03-01 09:10 UTC
From: a at phpe dot net Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.3.4 OS: windowx xp
Private report: No CVE-ID: None
 [2004-03-01 09:00 UTC] a at phpe dot net
Description:
------------
see the code below
the first block code's output i think will be: NULL & FALSE

As i think:
the code:
$a["a"]["b"];
will equal to 
array('a'=>array("b"));

may be i wrong? or that's a bug??


Reproduce code:
---------------
<?php
# First block
$a[] = "abc";
print_r($a);

// may be wrong here
echo $a[0][2]; // output: c, may be "null"?
echo isset($a[0][2]); // output: 1 (true), may be "false"?

######################

# Second block
$a["1"] = "123";
$a["1"]["2"] = 'abc';

print_r($a);
echo $a[1]; // output:12a, may will be "123"($a["1"]) ??
?>


Expected result:
----------------
Array
(
    [0] => abc
)

Array
(
    [0] => Array
           (
             [2] => abc
           )
    [1] => 123
)
12a


Actual result:
--------------
Array
(
    [0] => abc
)
c1

Array
(
    [0] => abc
    [1] => 12a
)
12a


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-01 09:01 UTC] a at phpe dot net
Expected result is:
----------------
Array
(
    [0] => abc
)

Array
(
    [0] => Array
           (
             [2] => abc
           )
    [1] => 123
)
123
 [2004-03-01 09:10 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 05:01:27 2020 UTC