Here is the main function that scans your entire project files for a specific line and tells you which file it is in and which char position starts with using only the base php. Hope this helps someone ...
<?php $find="somefunction()"; echo findString('./ProjectFolderOrPath/',$find); function findString($path,$find){ $return=''; ob_start(); if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if(is_dir($path.'/'.$file)){ $sub=findString($path.'/'.$file,$find); if(isset($sub)){ echo $sub.PHP_EOL; } }else{ $ext=substr(strtolower($file),-3); if($ext=='php'){ $filesource=file_get_contents($path.'/'.$file); $pos = strpos($filesource, $find); if ($pos === false) { continue; } else { echo "The string '$find' was found in the file '$path/$file and exists at position $pos<br />"; } }else{ continue; } } } } closedir($handle); } $return = ob_get_contents(); ob_end_clean(); return $return; } ?>
Lawrence Cherone Apr 02 2018-12-12T00: 00Z
source share