PHP: chdir() function
Description
The chdir() function is used to change the current working directory to a specified dir.
Version:
(PHP 4 and above)
Syntax:
chdir(dir_name)
Parameter:
Name | Description | Required / Optional |
Type |
---|---|---|---|
dir_name | The new current directory. | Required | String |
Return value:
TRUE on success or FALSE on failure.
Value Type: Boolean.
Example:
<?php
echo getcwd() .'<br>';
echo "Change to the 'test' directory".'<br>';
chdir('test');
echo getcwd() ;
?>
See also
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics