testing variable types
Posted: Fri Oct 24, 2008 3:07 pm
I am trying to do some light batch processing.
The browser complains that I'm passing in_array an illegal argument, but when I echo $tmpEvent, it prints out Array. Is it, or is it not an array? Effectively this algorithm is going to search a text file, one line at a time, for matches to the string in $searchParam.
Help!
K
Code: Select all
<?php
$searchParam = $_POST["searchParam"];
$file=fopen("calwid.txt", "r") or exit("Unable to open file!");
while (!feof($file))
{
$i = 0;
echo $tmpEvent = fgetcsv($file, 178);
if (in_array($searchParam, $tmpEvent))
{
echo $tmpEvent[$i];
$i++;
}
}
fclose($file);
?>
Help!
K