gudfry Posted July 22, 2008 Share Posted July 22, 2008 Hi all, I would like to find a word stored in a text file. if I found a word in text file like this /* $Author : Cahd */ I want to ouput it as Auhtor : Chad I looks like this $line = fopen('test.php'); foreach($line as $Line) { echo '<p>'.$Line.'</p>'; $output=processLine('$line'); if (processLine('/* $Author : Chad */')) { if (gettype($output)=="array") echo '<p>Title: '.($output[0]).' Value: '.$output[1].'</p>'; else echo '<p>Not a string according to definition</p>'; } } Link to comment https://forums.phpfreaks.com/topic/115979-how-to-find-a-keyword-on-a-file/ Share on other sites More sharing options...
mga_ka_php Posted July 22, 2008 Share Posted July 22, 2008 use regex Link to comment https://forums.phpfreaks.com/topic/115979-how-to-find-a-keyword-on-a-file/#findComment-596333 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.