PHP chdir() Function
PHP Directory Reference Manual
Example
Change the current directory:
"; // 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
);
| Parameters | Description |
|---|---|
| directory | Required. Specifies the new current directory. |
Technical Details
| Return Value: | Returns TRUE on success. Returns FALSE on failure and raises an E_WARNING level error. |
|---|---|
| PHP Version: | 4.0+ |
PHP Directory Reference Manual