#26761 [Opn->Csd]: array_search example bug

From: Date: Thu, 01 Jan 2004 22:35:13 +0000
Subject: #26761 [Opn->Csd]: array_search example bug
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969357818@lists.php.net to get a copy of this message
ID: 26761 Updated by: kennyt@php.net Reported By: andrew at netrux dot com -Status: Open +Status: Closed Bug Type: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: kennyt New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. I've actually already fixed this. It should show up the next time the manual is built. Thanks for the report. :) Previous Comments: ------------------------------------------------------------------------ [2004-01-01 17:33:05] andrew at netrux dot com Description: ------------ <?php $array = array(0 => "blue", 1 => "red", 2 => "green", 3 => "red"); $key = array_search($array, "green"); // $key = 2; $key = array_search($array, "red"); // $key = 1; ?> The array_search examples arguments are the wrong way around, there searching the needle with the haystack ;) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26761&edit=1

« previous php.doc (#969357818) next »