Bug #67543 [Opn->Nab]: array_values returns invalid value
| From: | requinix@php.net | Date: | Mon, 30 Jun 2014 06:01:02 +0000 |
| Subject: | Bug #67543 [Opn->Nab]: array_values returns invalid value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186387@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67543&edit=1
ID: 67543
Updated by: requinix@php.net
Reported by: eachcan at gmail dot com
Summary: array_values returns invalid value
-Status: Open
+Status: Not a bug
Type: Bug
Package: Arrays related
Operating System: All
PHP Version: 5.4.30
Block user comment: N
Private report: N
New Comment:
array_values() is not recursive.
Previous Comments:
------------------------------------------------------------------------
[2014-06-30 05:26:16] eachcan at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.array-values
---
array(0=>array(123)) == array(0=>array(0=>"123"))
//true
array_values(array(0=>array(123)))
// array(0=>array(0=>123))
array_values(array(0=>array(1=>123)))
// array(0=>array(0=>123))
array_values(array(0=>array(0=>123))) == array_values(array(0=>array(1=>123)))
// false
I don't know why, array_values returns completely same values but no equals to each other.
Test script:
---------------
<?php
assert('array(0=>array(123)) == array(0=>array(0=>"123"))');
assert('array_values(array(0=>array(0=>123))) ==
array_values(array(0=>array(1=>123)))');
Expected result:
----------------
true
Actual result:
--------------
false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67543&edit=1