Doc #80714 [Nab->Csd]: $a == $b it's false if $a and $b have the same key/value pairs

From: Date: Fri, 05 Feb 2021 13:03:12 +0000
Subject: Doc #80714 [Nab->Csd]: $a == $b it's false if $a and $b have the same key/value pairs
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18508@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80714&edit=1 ID: 80714 User updated by: glushkov1997 at icloud dot com Reported by: glushkov1997 at icloud dot com Summary: $a == $b it's false if $a and $b have the same key/value pairs -Status: Not a bug +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: Windows PHP Version: 7.4.15 Block user comment: N Private report: N New Comment: 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." Previous Comments: ------------------------------------------------------------------------ [2021-02-05 13:01:57] daverandom@php.net 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 http://www.php.net/support.php 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', ] vs [ 0 => '18', 1 => '15', ] ------------------------------------------------------------------------ [2021-02-05 12:56:19] glushkov1997 at icloud dot com Description: ------------ --- From manual page: https://php.net/language.operators.array --- Hello! 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80714&edit=1

« previous php.doc.bugs (#18508) next »