Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt

scandir( $path) returns the searched result in array.


Info

$result = scandir(directory, order, context)

  • it returns false on failure.

...

Code Block
function findfiles( $path, $regex$regexp)
{
	        $r = scandir( $path);
        if ($r==true)
        {
                $i=count($r)-1;
                while($i>=0)
                {
                        if (!preg_match('/' . $regexp . '/', $r[$i])) unset($r[$i]);
                        $i--;
                }
                return $r;
        }
}

$r = findfiles( "/repostirory", "mysql");
print_r($r);