English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Directory Reference Manual
The chdir() function is used to change the current directory.
bool chdir ( string $directory )
It changes the current directory of PHP to the directory passed.
Number | Parameters and Description |
---|---|
1 | directory(Required) Changes the current directory of PHP to directory. |
Returns TRUE on success, FALSE on failure.
Here is the usage of this function, changing the current directory:
<?php echo getcwd() . "\n"; chdir('html'); echo getcwd() . "\n"; ?>Test and see‹/›
Output result:
/home/w3codebox /home/w3codebox/html