How to create and remove directory / folder in PHP

Directoty manage funcations are vital and here are some useful functions to create and remove directories using PHP 5.2.

Remove 

$mydir = '/path/directory/images/'; // this will remove images directory
if (is_dir($mydir)) {
    rmdir($mydir);
} else {
    echo $mydir.
    ' does not exists';
}
 
Create
$mydir = '/path/directory/images/
mkdir($mydir);