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; } } ?>




Reply With Quote