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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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: Fri May 03 05:01:29 2024 UTC