PHP mkdir recursive with parents

Recursively create directories in PHP with mkdir().

$ mkdir --parents
function mkdir_p($directory, $mode=0700) {
    $recursive = TRUE;
    return @mkdir($directory, $mode, $recursive);
}

Note the @ is to ignore any existing folder.

View this page on GitHub.
Posted .

1 comment

  1. anonymous

    what about:

    mkdir($_SERVER['DOCUMENT_ROOT'] . _PATH . '/' . $directory, 777, true);

Leave a Reply