Php scandir
From w3cyberlearnings
Contents |
PHP function scandir
This function returns an array of files and directory.
Syntax scandir
- dir is a directory to scan
- sort (optional) is the sort order. sort=1 is descending sort order. It's default value is 0 (ascending).
- context (optional) is context option that can modify the behavior of a stream.
scandir(dir, sort, context);
Example 1
<?php $path = dirname(__FILE__).'/mydir'; $aa = scandir($path); print_r($aa); ?>
Output
Array ( [0] => . [1] => .. [2] => a1 [3] => a2 [4] => ab [5] => ac [6] => learn.txt [7] => school )
--chdir-- chroot-- closedir-- dir-- getcwd-- opendir-- readdir-- rewinddir-- scandir--