I have some .php files in a directory that calls a user defined function:
_l($string);
each time different string is passed to that function and all strings are static, (i.e. not a single string is entered by user input).
Now I want a script that can list down all the strings form all the files of that directory, which are passed into _l($string); I had tried:
$fp = fopen($file, "r");
while(!feof($fp)) {
$content .= fgets($fp, filesize($file));
if(preg_match_all('/(_l\(\'.*?\'\);)/', fgets($fp, filesize($file)), $matches)){
foreach ($matches as $key => $value) {
array_push($text, $value[0]);
}
}
}
I get strings but not every strings those are in files, some strings are not match with given regex, so what are the condiotion that is required to get all the strings?
fgets(), try removing the one in thepreg_match_allcall and use$contentinstead.