X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP chdir() Function

PHP Directory PHP Directory Reference

Example

Change the current directory:

<?php
// Get current directory
echo getcwd() . "<br>";

// Change directory
chdir("images");

// Get current directory
echo getcwd();
?>

Result:

/home/php
/home/php/images


Definition and Usage

The chdir() function changes the current directory.


Syntax

chdir(directory);

Parameter Description
directory Required. Specifies the new current directory

Technical Details

Return Value: TRUE on success. FALSE on failure. Throws an error of level E_WARNING on failure
PHP Version: 4.0+


PHP Directory PHP Directory Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook