Im only a begginer in PHP so Im really sorry if it is just a stupid question.I have a directory full of .txt files and I have written a code to find a specific string inside those files and echo the whole line :
<?php
$search = $_POST['search'];
$dir = 'C:\xampp\htdocs\myfiles\dbl';
$files = scandir($dir,1);
foreach ($files as $lines){
foreach($lines as $line)
{
if(strpos($line, $search) !== false)
echo $line;
}
}
?>
However,I keep getting this error : Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\myfiles\search.php on line 19