<?php
echo 'GLOB'.PHP_EOL;
$arquivos = glob("{*.php,*.jpg}", GLOB_BRACE
); foreach($arquivos as $img) echo $img.PHP_EOL;
echo PHP_EOL;
$types = array( 'php', 'jpg' );
echo 'DIR FUNCTIONS'.PHP_EOL;
while ( $entry = readdir( $handle ) ) { if( in_array( $ext, $types ) ) echo $entry.PHP_EOL
; }
}
echo PHP_EOL;
echo 'DIRECTORY ITERATOR'.PHP_EOL;
$path = '.';
$dir = new DirectoryIterator($path);
foreach ($dir as $fileInfo) {
if( in_array( $ext, $types ) ) echo $fileInfo->getFilename().PHP_EOL
; }
PD9waHAKCWVjaG8gJ0dMT0InLlBIUF9FT0w7CgljaGRpciggJy4nICk7CgkkYXJxdWl2b3MgPSBnbG9iKCJ7Ki5waHAsKi5qcGd9IiwgR0xPQl9CUkFDRSk7Cglmb3JlYWNoKCRhcnF1aXZvcyBhcyAkaW1nKSBlY2hvICRpbWcuUEhQX0VPTDsKCWVjaG8gUEhQX0VPTDsKCgkkdHlwZXMgPSBhcnJheSggJ3BocCcsICdqcGcnICk7CgkKICAgIGVjaG8gJ0RJUiBGVU5DVElPTlMnLlBIUF9FT0w7CglpZiAoICRoYW5kbGUgPSBvcGVuZGlyKCcuJykgKSB7CgkgICAgd2hpbGUgKCAkZW50cnkgPSByZWFkZGlyKCAkaGFuZGxlICkgKSB7CgkgICAgCSRleHQgPSBzdHJ0b2xvd2VyKCBwYXRoaW5mbyggJGVudHJ5LCBQQVRISU5GT19FWFRFTlNJT04pICk7CgkJCWlmKCBpbl9hcnJheSggJGV4dCwgJHR5cGVzICkgKSBlY2hvICRlbnRyeS5QSFBfRU9MOwoJICAgIH0KCSAgICBjbG9zZWRpcigkaGFuZGxlKTsKCX0gICAgCgllY2hvIFBIUF9FT0w7CgogICAgZWNobyAnRElSRUNUT1JZIElURVJBVE9SJy5QSFBfRU9MOwoJJHBhdGggPSAnLic7CgkkZGlyID0gbmV3IERpcmVjdG9yeUl0ZXJhdG9yKCRwYXRoKTsKCWZvcmVhY2ggKCRkaXIgYXMgJGZpbGVJbmZvKSB7CiAgICAJJGV4dCA9IHN0cnRvbG93ZXIoICRmaWxlSW5mby0+Z2V0RXh0ZW5zaW9uKCkgKTsKCSAgICBpZiggaW5fYXJyYXkoICRleHQsICR0eXBlcyApICkgZWNobyAkZmlsZUluZm8tPmdldEZpbGVuYW1lKCkuUEhQX0VPTDsKCX0gICAgCg==