<?php
$dir = new RecursiveDirectoryIterator('c:/wamp64/www/rey/SufarmaERP/api');
$iterator = new RecursiveIteratorIterator($dir);
foreach ($iterator as $file) {
    if ($file->isFile() && $file->getExtension() === 'php') {
        $content = file_get_contents($file->getPathname());
        if (stripos($content, 'lote') !== false) {
            echo "FILE: " . $file->getPathname() . PHP_EOL;
            // Let's print matching lines
            $lines = explode(PHP_EOL, $content);
            foreach ($lines as $i => $line) {
                if (stripos($line, 'lote') !== false) {
                    echo "  Line " . ($i + 1) . ": " . trim($line) . PHP_EOL;
                }
            }
        }
    }
}
