|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-11-21 17:35 UTC] jani@php.net
[2008-11-24 13:26 UTC] realbaziak at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
Description: ------------ Equality operator returns true, though arrays are different. Is it a bug or feature? :) Thanks. Reproduce code: --------------- $a = array(0 => "something"); $b1 = array(0 => "another"); $b2 = array(0 => "0"); $b3 = array(0 => null); $b4 = array(0 => 0); $a2 = array(0 => "two", 1 => "elements"); $b5 = array(0 => 0, 1 => 0); var_dump($a == $b1); // bool(false) var_dump($a == $b2); // bool(false) var_dump($a == $b3); // bool(false) var_dump($a == $b4); // bool(true) -- why array(0 => "something") // equals to array(0 => 0)? var_dump($a2 == $b5); // bool(true) -- it seems there are some regularity Expected result: ---------------- always bool(false) Actual result: -------------- bool(true) on something like array(0 => "one", 1 => "two") == array(0 => 0, 1 => 0)