I have a bit of PHP used to pulled a list of files from my image directory - it\'s used in a form to select where an uploaded image will be saved. Below is the code:
You could just use your array_map function combined with glob
array_map
glob
$folders = array_map(function($dir) { return basename($dir); }, glob('../images/*', GLOB_ONLYDIR));
Yes, I copied a part of it of dev-null-dweller, but I find my solution a bit more re-useable.