2 /* Prototype: bool mkdir ( string $pathname [, int $mode [, bool $recursive [, resource $context]]] );
3 Description: Makes directory
6 $context = stream_context_create();
8 $file_path = dirname(__FILE__
);
10 echo "\n*** Testing mkdir() and rmdir() by giving stream context as fourth argument ***\n";
11 var_dump( mkdir("$file_path/mkdir_variation2/test/", 0777, true, $context) );
12 var_dump( rmdir("$file_path/mkdir_variation2/test/", $context) );
14 echo "\n*** Testing rmdir() on a non-empty directory ***\n";
15 var_dump( mkdir("$file_path/mkdir_variation2/test/", 0777, true) );
16 var_dump( rmdir("$file_path/mkdir_variation2/") );
18 echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n";
19 var_dump( mkdir("$file_path/temp".chr(0)."/") );
20 var_dump( rmdir("$file_path/temp".chr(0)."/") );
22 echo "\n*** Testing mkdir() with miscelleneous input ***\n";
23 /* changing mode of mkdir to prevent creating sub-directory under it */
24 var_dump( chmod("$file_path/mkdir_variation2/", 0000) );
25 /* creating sub-directory test1 under mkdir, expected: false */
26 var_dump( mkdir("$file_path/mkdir_variation2/test1", 0777, true) );
27 var_dump( chmod("$file_path/mkdir_variation2/", 0777) ); // chmod to enable removing test1 directory
31 rmdir(dirname(__FILE__
)."/mkdir_variation2/test/");
32 rmdir(dirname(__FILE__
)."/mkdir_variation2/");