"Ian Barnes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > [code] > $file=file("/ian/testing.file"); file://Load the file into array > unset($file[0]); file://Remove the first #gc line > foreach($file as $line){ // Run through each array line > $array[]=explode(",", $line); file://Separate each line in key/variable. > } > [/code] > > [code] > foreach($file as $line){ > if((in_array("1100", $line)) and (in_array("eth0", $line))){ > echo "Found eth0 and 1100 in array. Checkbox can be checked"; > }else{ > echo "Not found"; > } > } > [/code]
Shouldn't you be looping through $array here (look at your first code sample at the top)?: foreach ($array as $subarray) { if (in_array('1100', $subarray) && in_array('eth0', $subarray)) { echo 'Found eth0 and 1100 in array. Checkbox can be checked'; } else { echo 'Not found'; } } Please try if it works. If so you could change all your foreach() loops to for() loops because you don't deal with associative arrays here and foreach creates copies of all values in memories. With for() you can directly acces the array values with $array[$i] etc. Regards, Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php