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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: eachcan at gmail dot com
New email:
PHP Version: OS:

 

 [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: Wed Apr 24 04:01:30 2024 UTC