function mkDir($args)
    {
        $opts = System::_parseArgs($args, 'pm:');
        if (PEAR::isError($opts)) {
            return System::raiseError($opts);
        }

        $mode = 0777; // default mode
        foreach ($opts[0] as $opt) {
            if ($opt[0] == 'p') {
                $create_parents = true;
            } elseif ($opt[0] == 'm') {
                // if the mode is clearly an octal number (starts with 0)
                // convert it to decimal
                if (strlen($opt[1]) && $opt[1]{0} == '0') {
                    $opt[1] = octdec($opt[1]);
                } else {
                    // convert to int
                    $opt[1] += 0;
                }
                $mode = $opt[1];
            }
        }

        $ret = true;
        if (isset($create_parents)) {
            foreach ($opts[1] as $dir) {
                $dirstack = array();
                while ((!file_exists($dir) || !is_dir($dir)) &&
                        $dir != DIRECTORY_SEPARATOR) {
                    array_unshift($dirstack, $dir);
                    $dir = dirname($dir);
                }

                while ($newdir = array_shift($dirstack)) {
                    if (!is_writeable(dirname($newdir))) {
                        $ret = false;
                        break;
                    }

                    if (!mkdir($newdir, $mode)) {
                        $ret = false;
                    }
                }
            }
        } else {
            foreach($opts[1] as $dir) {
                if ((@file_exists($dir) || !is_dir($dir)) && !mkdir($dir, $mode)) {
                    $ret = false;
                }
            }
        }

        return $ret;
    }
function mkDir($args)
    {
        $opts = System::_parseArgs($args, 'pm:');
        if (PEAR::isError($opts)) {
            return System::raiseError($opts);
        }

        $mode = 0777; // default mode
        foreach ($opts[0] as $opt) {
            if ($opt[0] == 'p') {
                $create_parents = true;
            } elseif ($opt[0] == 'm') {
                // if the mode is clearly an octal number (starts with 0)
                // convert it to decimal
                if (strlen($opt[1]) && $opt[1]{0} == '0') {
                    $opt[1] = octdec($opt[1]);
                } else {
                    // convert to int
                    $opt[1] += 0;
                }
                $mode = $opt[1];
            }
        }

        $ret = true;
        if (isset($create_parents)) {
            foreach ($opts[1] as $dir) {
                $dirstack = array();
                while ((!file_exists($dir) || !is_dir($dir)) &&
                        $dir != DIRECTORY_SEPARATOR) {
                    array_unshift($dirstack, $dir);
                    $dir = dirname($dir);
                }

                while ($newdir = array_shift($dirstack)) {
                    if (!is_writeable(dirname($newdir))) {
                        $ret = false;
                        break;
                    }

                    if (!mkdir($newdir, $mode)) {
                        $ret = false;
                    }
                }
            }
        } else {
            foreach($opts[1] as $dir) {
                if ((@file_exists($dir) || !is_dir($dir)) && !mkdir($dir, $mode)) {
                    $ret = false;
                }
            }
        }

        return $ret;
    }
function mkDir ( $ args ) { $ opts = System :: _parseArgs ( $ args , 'pm:' ) ; if ( PEAR :: isError ( $ opts ) ) { return System :: raiseError ( $ opts ) ; } $ mode = 0777 ; // default mode foreach ( $ opts [ 0 ] as $ opt ) { if ( $ opt [ 0 ] == 'p' ) { $ create_parents = true ; } elseif ( $ opt [ 0 ] == 'm' ) { // if the mode is clearly an octal number (starts with 0) // convert it to decimal if ( strlen ( $ opt [ 1 ] ) && $ opt [ 1 ] { 0 } == '0' ) { $ opt [ 1 ] = octdec ( $ opt [ 1 ] ) ; } else { // convert to int $ opt [ 1 ] += 0 ; } $ mode = $ opt [ 1 ] ; } } $ ret = true ; if ( isset ( $ create_parents ) ) { foreach ( $ opts [ 1 ] as $ dir ) { $ dirstack = array ( ) ; while ( ( ! file_exists ( $ dir ) || ! is_dir ( $ dir ) ) && $ dir != DIRECTORY_SEPARATOR ) { array_unshift ( $ dirstack , $ dir ) ; $ dir = dirname ( $ dir ) ; } while ( $ newdir = array_shift ( $ dirstack ) ) { if ( ! is_writeable ( dirname ( $ newdir ) ) ) { $ ret = false ; break ; } if ( ! mkdir ( $ newdir , $ mode ) ) { $ ret = false ; } } } } else { foreach ( $ opts [ 1 ] as $ dir ) { if ( ( @ file_exists ( $ dir ) || ! is_dir ( $ dir ) ) && ! mkdir ( $ dir , $ mode ) ) { $ ret = false ; } } } return $ ret ; }
Make directories.

The -p option will create parent directories
@param    string  $args    the name of the director(y|ies) to create
@return   bool    True for success
@static
@access   public
Make directories .