Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_scan_dir($dir) // it works, for now.........
- {
- if (is_dir($dir))
- {
- // detect if the path has arabic characters and convert it so it works
- if (preg_match('#[\x{0600}-\x{06FF}]#iu', $dir))
- {
- $dir = iconv("utf-8", "windows-1256", $dir);
- }
- if ($handle = opendir('.')) {
- while (false !== ($file = readdir($handle)))
- {
- if ($file != "." && $file != ".." && strtolower(substr($file, strrpos($file, '.') + 1)) == 'png')
- {
- return $file . PHP_EOL;
- }
- }
- closedir($handle);
- }
- else
- {
- print("\nERROR! Can't find directory!\n");
- }
- }
- else
- {
- print("\nERROR! Parameter isn't a directory!\n");
- }
- }
- // my_scan_dir("./");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement