$value) { $array[] = explode(" ", $value); } $lines = array_splice($array, 0, 1); $counter = 0; for ($i=0; $i<$lines[0][0]; $i++) { if (strpos($array[$i][0], "LOVE") !== false) { echo "YES".PHP_EOL; $counter++; break; } } if ($counter == 0) { echo "NO".PHP_EOL; } ?>