#20766 [Opn->Bgs]: array_search doesn't return value with array as needle

From: Date: Tue, 03 Dec 2002 00:56:19 +0000
Subject: #20766 [Opn->Bgs]: array_search doesn't return value with array as needle
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-26440@lists.php.net to get a copy of this message
ID: 20766 Updated by: sniper@php.net Reported By: francisf@videotron.ca -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Linux 2.2.20 PHP Version: 4.2.3 New Comment: It's printing just the correct values. Your $t2 array does not contain same array as $t1 is.. (try adding this: $t2[] = $t1; and you'll see..) Previous Comments: ------------------------------------------------------------------------ [2002-12-02 12:41:23] francisf@videotron.ca $t1[] = "banana"; $t1[] = "orange"; $t1[] = "kiwi"; $t2[] = "car"; $t2[] = "kiwi"; $t2[] = "cat"; print "Kiwi key: ".array_search($t1,$t2); print "Car key: ".array_search("car",$t2); this code print: Kiwi key: Car key: 0 Should print: Kiwi key: 1 Car key: 0 Apache: 1.3.26 rh 6.2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20766&edit=1

« previous php.bugs (#26440) next »