Last active
May 27, 2018 19:39
-
-
Save atillay/5c3757384a73f50fe9f2b229f41eb34d to your computer and use it in GitHub Desktop.
yolo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('PATTERN', '*.{jpg,jpeg,gif,png}'); | |
function getFilesIn(string $path): array | |
{ | |
$files = glob($path . '/' . PATTERN, GLOB_BRACE); | |
foreach (glob($path . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $subDir) { | |
$files = array_merge($files, getFilesIn($subDir)); | |
} | |
return $files; | |
} | |
$images = getFilesIn(__DIR__); | |
var_dump($images); | |
die; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment