/hphp/test/slow/ext_file/readdir.php

http://github.com/facebook/hiphop-php · PHP · 37 lines · 29 code · 8 blank · 0 comment · 11 complexity · 95bc76803d351ddb926c84f6a75f66ce MD5 · raw file

  1. <?hh
  2. <<__EntryPoint>>
  3. function main_readdir() {
  4. $d = dir(__DIR__);
  5. while ($ent = readdir($d->handle)) {
  6. if ($ent == 'test_ext_file.txt') {
  7. var_dump($ent);
  8. }
  9. }
  10. closedir($d->handle);
  11. $d = opendir(__DIR__);
  12. while ($ent = readdir($d)) {
  13. if ($ent == 'test_ext_file.txt') {
  14. var_dump($ent);
  15. }
  16. }
  17. rewinddir($d);
  18. while ($ent = readdir($d)) {
  19. if ($ent == 'test_ext_file.txt') {
  20. var_dump($ent);
  21. }
  22. }
  23. closedir($d);
  24. foreach (scandir(__DIR__) as $x) {
  25. if ($x == 'test_ext_file.txt') {
  26. var_dump($x);
  27. }
  28. }
  29. }