I have a code which read file inside a directory.
But I am using ereg()
,
Now I am getting a deprecated error on PHP 5.3.
After search on google, someone said to replace ereg()
with perg_match()
.
But after replacing with perg_math()
I am getting an error:
preg_match(): No ending delimiter '.' found
I am not a PHP expert kndly fix this problem.
$path = THEME_DIR.'/'.$path;
foreach(array_diff(scandir($path), array('.', '..')) as $f)
if (is_file($path . '/' . $f) && (('.php') ? ereg('.php' . '$' , $f) : 1))
$l[] = $f;
return $l;