Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

mkdir()

Example

Make the following directory, “test”:

<?php
mkdir(“test”);
?>

Definition and Usage

A directory can be created by using the mkdir() function and a pathname.

Syntax

mkdir(pathmoderecursivecontext)

Parameter Values

Parameter

Description

path

Essential. Gives the path of the directory to be created.

mode

Not required. details the permissions. The mode is 0777 (widest possible access) by default.
Note: On Windows platforms, the mode settings are ignored!
There are four numbers in the mode parameter:

·         There is always zero for the first number.

·         Permissions for the owner are indicated by the second number.

·         The owner’s user group’s permissions are specified by the third number.


·         The fourth figure denotes permissions for all other parties.
Potential values (adjust the following numbers to set multiple permissions):

1 = carry out authorizations
2 = obtain authorization
4 = review the permissions

recursive

Not required. indicates whether the recursive mode (introduced in PHP 5) is enabled.

context

Not required. Indicates the file handle’s context. Context is a collection of parameters that can change a stream’s behavior (introduced in PHP 5)

Technical Details

 

Return Value:

FALSE when it fails, TRUE when it succeeds

PHP Version:

4.0+