Yes, that is actually $temp, not $temp1. However, my problem still remains the same. Several lines in the file contain the exact same string as the one I am comparing. I need their positions in the array so that I can operate on other lines in the file. That is why I am using file( ) instead of other file reader functions. Thanks. MM.
> $name = $_POST["filename"]; > $lines = file($name); > $i = 0; > $len = sizeof($lines); > //echo $i; > while($i < $len) { > //echo $lines[$i]; > $temp = $lines[$i]; > $temp = trim($temp); > //echo $temp; > if($temp1 == '--------------------------------------') { This should be $temp, shoudn't it? > echo $i; > return $i; > } > else > $i++; > }