#43733 [Opn->Csd]: array_keys returns keys from sub arrays in multi-dimensional array
| From: | lakinekaki at gmail dot com | Date: | Fri, 04 Jan 2008 19:48:15 +0000 |
| Subject: | #43733 [Opn->Csd]: array_keys returns keys from sub arrays in multi-dimensional array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121043@lists.php.net to get a copy of this message | ||
ID: 43733
User updated by: lakinekaki at gmail dot com
Reported By: lakinekaki at gmail dot com
-Status: Open
+Status: Closed
Bug Type: Arrays related
Operating System: Linux
PHP Version: 4.4.7
New Comment:
I am devoid of reading comprehension. The very first line in the manual
said that function returns all array keys. However, example was little
confusing and led me to believe the opposite.
Previous Comments:
------------------------------------------------------------------------
[2008-01-03 01:05:53] lakinekaki at gmail dot com
Description:
------------
http://us2.php.net/function.array-keys
when compared with result c from example on above page, it seems that
what i get is not expected result. array-keys function tests against all
keys in all sub arrays!
Reproduce code:
---------------
<?php
//example array of simple website navigation structure
$array = array("about.php","contact.php","projects.php" =>
array("project_1.php" =>
array("project_1a.php","project_1b.php"),"project_2.php"));
if(in_array('project_1.php',array_keys($array)))echo 'not working as
expected';
?>
Expected result:
----------------
I expect no output, but see 'not working as expected'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43733&edit=1