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.

Did this help you? Please let me know with a comment. Thank you
Posted .

1 comment (RSS)

  1. anonymous

    what about:

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

Leave a comment