php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67543 array_values returns invalid value
Submitted: 2014-06-30 05:26 UTC Modified: 2014-06-30 06:01 UTC
From: eachcan at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.4.30 OS: All
Private report: No CVE-ID: None
 [2014-06-30 05:26 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-30 06:01 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2014-06-30 06:01 UTC] requinix@php.net
array_values() is not recursive.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC