PHP does not support brace expansion in the same way as the shell does. If you want to create multiple directories, you will have to call mkdir() multiple times, and you can easily do this by looping.
You can pass TRUE as the third argument to mkdir() - this means that all directories back up the tree will also be created if they do not exist and the parent is writable. You can safely pass TRUE to all calls when operating in a loop, the first iteration for a given directory will create it, subsequent calls will have no adverse effect.
For example:
$toCreate = array(
'dir1/dir1-1',
'dir1/dir1-2'
);
$permissions = 0755;
foreach ($toCreate as $dir) {
mkdir($dir, $permissions, TRUE);
}
mkdir()twice?mkdircommand, not the PHP function. The PHP functions using OS calls, it does not executemkdir. If you want to implement functionality like this, you will have to write it yourself I'm afraid... PHP'smkdir()takes one literal path and attempts to create it, it performs no parsing of the string you passed.bashdoing the expansion in that article. You'd have to emulate the same thing in PHP, effectively callingmkdirmultiple times.