|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80714 $a == $b it's false if $a and $b have the same key/value pairs
Submitted: 2021-02-05 12:56 UTC Modified: 2021-02-05 13:34 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: glushkov1997 at icloud dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 7.4.15 OS: Windows
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.
Block user comment
Status: Assign to:
Bug Type:
From: glushkov1997 at icloud dot com
New email:
PHP Version: OS:


 [2021-02-05 12:56 UTC] glushkov1997 at icloud dot com
From manual page:


var_dump(['15', '18'] == ['18', '15']); //it's false 

I think there is a documentation's mistake 
$a == $b Equality true if $a and $b have the same key/value pairs.

Please check. Have a good day! 

Test script:
var_dump(['15', '18'] == ['18', '15']); //it's false 

Expected result:
var_dump(['15', '18'] == ['18', '15']); // true

Actual result:
var_dump(['15', '18'] == ['18', '15']); //it's false 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-05 13:01 UTC]
-Status: Open +Status: Not a bug
 [2021-02-05 13:01 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

['15', '18'] and ['18', '15'] do not have the same key/value pairs, the keys are reversed.

  0 => '15',
  1 => '18',


  0 => '18',
  1 => '15',
 [2021-02-05 13:03 UTC] glushkov1997 at icloud dot com
-Status: Not a bug +Status: Closed
 [2021-02-05 13:03 UTC] glushkov1997 at icloud dot com
Unfortunately, I don't read good documentation. I found this sentence too late "Elements of arrays are equal for the comparison if they have the same key and value."
 [2021-02-05 13:34 UTC]
-Status: Closed +Status: Not a bug
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Aug 01 15:01:24 2021 UTC