Hello,
I am simply trying to see if a value exists in an array of external file read by the file() function but unfortunately neither the in_array function is working nor the search_array. My code looks like this.
txt file, colors.txtPHP Code:<?php
//$arr = array('red', 'green', 'blue');
$arr = file('colors.txt');
if(in_array('green',$arr)){
echo "Fount at index:".in_array('green',$arr);
} else {
echo "Not found";
}
?>
It works with the arrays created with the array function but not with the file function any help would be appreciated. Thanks.Code:red green blue green



Reply With Quote

Bookmarks