...
| Code Block |
|---|
// Programmed by Chun Kang - 2020-03-27
function findfiles( $path, $regexp="", $order=0)
{
$r = scandir( $path, $order); // $order: 0->ascending / 1->descending
if ($r==false) return $ret=$r;
else if ($regexp!="")
{
{
$ret=array();
$i=count($r)-1;
while($i>=0)
{
for($i=0; $i<count($r); $i++)
{
if (!preg_match('/' . $regexp . '/', $r[$i])) unset($ret[]=$r[$i]);
$i--;
;
}
}
return $r$ret;
}
$r = findfiles( "/repostirory", "qsok(.*)mysql");
print_r($r); |
...