How to check if specific text exists in text file with PHP

1 Answer

0 votes
$filename = 'd:\\data.txt';

$arr = file($filename, FILE_IGNORE_NEW_LINES);

if (in_array("php", $arr)) 
    echo "text exists";
else    
    echo "text not exists";


/*
run: 

text exists

*/

 



answered Jul 16, 2017 by avibootz

Related questions

1 answer 388 views
1 answer 292 views
1 answer 302 views
302 views asked Dec 16, 2015 by avibootz
2 answers 344 views
1 answer 297 views
1 answer 370 views
...