Well, this is one way of doing it. Probably not the most efficient way of doing it, but it works.
<?php
$folders = Array(
Array("img", "dummies", "slides", "01.jpg"),
Array("img_24", "dummy", "slideshows", "65.png")
);
for ($i=0;$i<count($folders);$i++) {
for ($j=0;$j<count($folders[$i]);$j++) {
$path .= $folders[$i][$j] . "/";
mkdir($path);
}
unset($path);
}
?>
It basically reads the array and places each name into a single variable, which extends itself so that it creates a path. The JPEG file is not created, of course, but that's something you can do with file_put_contents or so, just give it another array value referring as "file" instead of the default "folder" definition. Then when it reads the definition it automatically creates a file instead of a folder and then writes in the bitmap data.
EDIT: For file creation, you can use file_put_contents like I explained above, I made a small piece of code to demonstrate the use.
<?php
$folders = Array(
Array("img", "dummies", "slides", Array("01.jpg", "11abcdefghijklmnopqrstuvxyz")),
Array("img_24", "dummy", "slideshows", Array("65.png", "22abcdefghijklmnopqrstuvxyz"))
);
for ($i=0;$i<count($folders);$i++) {
for ($j=0;$j<count($folders[$i]);$j++) {
$path .= (gettype($folders[$i][$j]) != "array" ? $folders[$i][$j] . "/" : $folders[$i][$j][0]);
if (gettype($folders[$i][$j]) != "array") {
mkdir($path);
}else{
file_put_contents($path, (isset($folders[$i][$j][1]) ? $folders[$i][$j][1] : "nil"));
}
}
unset($path);
}
?>
The JPEG file's second value is used for the content of the file. You can put the bitmap data in that by reading the file you're using and then placing it in as a value. That way you get the image created properly.
$fold=$i<($imglength-1);What is that? You know that this variable will just contain eithertrueorfalse, right?array_map('mkdir', $array)? (if file/dir exists, it will fail, but continue)