without echoing the variable to the screen I don't think there is a hard and fast way to do it. maybe Dennis would know, but I don't think you can.
Printable View
without echoing the variable to the screen I don't think there is a hard and fast way to do it. maybe Dennis would know, but I don't think you can.
Here I come to the recue!
file() reads a file into an array, each element is one line of the file.
Code:<?php
$filearr = file("filename.txt");
$arrlen = count($filearr);
$matchvar = "hello";
for($i = 0; $i < $arrlen; $i++)
{
if($filearr[$i] == $matchvar)
{
$found = $filearr[$i];
$foundnum = $i;
break;
}
}
?>
SuperDennis the PHP warrior :p