Q:

PHP Display most recent images from folders

I would like to show most recent images from 6 folders. 
Images are named like this: 20150126.jpg, 20150127.jpg
It works, but shows all images from 1st directory than from 2nd directory etc.
How to mix it and show the newest images?
$directory = "*/";
$pictures = glob("" . $directory . "*.jpg");
$no_pictures = count($pictures)-1;  
$limit = $no_pictures-8;           
for( $i = $no_pictures; $i >= $limit; $i--){  
echo "<img width='300px' src=\"".$pictures[$i]."\" />\n"; 
}  

A:

You can solve this by soring your $pictures array. If you want the most recent to be at the top, you will want to sort in reverse, or output in reserve.
Look at sort():
http://php.net/manual/en/function.sort.php
EDIT: In accordance with your output, I would suggest the following algorithm (although there are multiple ways to do it):

Get the list of directories only from the parent dir. You can use glob() with the GLOB_ONLYDIR option.
Loop through the dirs you get from 1, and get the file names for each directory (without additional path info). Merge the files into a new array with the file name first. It will have some kind of formatted string (you can go fancy with JSON or just use some simple delimiter like a colon). For example, the new array will have the entries: 20150126.jpg:ciazowe, 20150127.jpg:event, etc.
Sort this array.
Output "backwards" like you did, only with the correct path info.

