I'm checking to see if a folder exists by using the file_exists function.
If it doesn't, I'm creating a set of folders.
If it does exist, I want it to carry on creating the folders but the top folder should increment an id #1 , #2 , #3 etc each time.
if (file_exists('temp/$email')) {
mkdir("temp/$email/");
mkdir("temp/$email/css");
mkdir("temp/$email/js");
mkdir("temp/$email/images");
} else {
$version = 0;
$version++;
mkdir("temp/$email$version/");
mkdir("temp/$email$version/css");
mkdir("temp/$email$version/js");
mkdir("temp/$email$version/images");
}
Something along the lines of this but obviously that won't work. How can I go about doing this?
Also - is there a cleaner / simpler way of doing multiple mkdirs instead of writing them out in a long list like how I've done?