note 16883 deleted from function.array-search by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 21:05:18 +0000 |
| Subject: | note 16883 deleted from function.array-search by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22184@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") and carriage returns ("\r") are left on each line of the array. These
characters cause functions like array_search() to appear to fail as the line endings are somewhat
hidden.
Use something like this to do a cleanup before using array_search() or in_array():
$array = str_replace (array("\r", "\n"), '', file ($file));