← All built-ins / scandir()
scandir()
scandir(string $s): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $path | string | directory path |
Return value
Array of entry names (including "." and "..").
Example
mkdir("/tmp/hphp_doc_sc");
file_put_contents("/tmp/hphp_doc_sc/a.txt", "1");
echo count(scandir("/tmp/hphp_doc_sc")) >= 3 ? "listed" : "empty";
unlink("/tmp/hphp_doc_sc/a.txt");
rmdir("/tmp/hphp_doc_sc");listed