note 16883 added to function.array-search

From: Date: Sat, 17 Nov 2001 06:06:20 +0000
Subject: note 16883 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-20942@lists.php.net to get a copy of this message
NOTE!! When using "file" to load the contents of a file into an array newlines "\n" are inclued on each line of the array. The newlines cause functions like array_search to appear to fail as the newline is somewhat hidden. Use something like this to do a cleanup before using array_search or in_array: for ($temp = 0; $temp < count($formatTemplate); $temp++) { $formatTemplate[$temp] = ereg_replace ("\n", "", $formatTemplate[$temp]); } -- http://www.php.net/manual/en/function.array-search.php http://master.php.net/manage/user-notes.php?action=edit+16883 http://master.php.net/manage/user-notes.php?action=delete+16883 http://master.php.net/manage/user-notes.php?action=reject+16883

« previous php.notes (#20942) next »