I have found some odd behavious with the array_serach fnction.
Look at this piece of code:
Code: Select all
$list=file("email_list.txt");
$list=array_map("trim",$list);
foreach($list as $val){
echo "-$val-";
}-1--2--3-
ie. the file is 3 lins long with the number 1,2,3 on each line. I am then searching the array for a match as follows:
Code: Select all
if (array_search('1', $list)) {
echo"Value exists in the array!";
}Am I going mad?
Rob.