Fastest way to find string into a file PHP with ~ 5000 lines -
i know fastest way find string in file using php. have been told quickest way read file using file()
function, find string in whole file have foreach. whereas if use file_get_contents
or something, have strpos()
on file.
the point not know if strpos() faster (i think is). know if, better content of file , strpos() once, or file line line , strpos() foreach line until find value (or until end if value not found).
using strpos
file_get_contents
like
if( strpos(file_get_contents("filename.txt"), $string) !== false) { // stuff }
would fastest way
Comments
Post a Comment