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 270 views
1 answer 200 views
1 answer 201 views
201 views asked Dec 16, 2015 by avibootz
2 answers 221 views
1 answer 196 views
1 answer 259 views
...