PHP mkdir() Examples


mkdir() function creates a new directory. If success, return TRUE, otherwise FALSE.

<?PHP
    mkdir("tp/");  //create directory tp/ in current directory by default
	mkdir("./tp/"); //create directory tp/ in current directory
	mkdir("../tp/"); //create directory tp/ in upper directory	
?>

By default the new created directory can be accessed and modified. To create a read only directory.
<?PHP
   mkdir("tp/",0400);
?>

rmdir() delete an empty directory.
<?PHP
	rmdir("tp/");
?>