Change the current working directory.
<?php // Get current directory echo getcwd() . “<br>”; // Change directory chdir(“images”); // Get current directory echo getcwd(); ?> |
Result:
/home/php /home/php/images |
The chdir() function changes the current working directory.
chdir(directory) |
Parameter |
Description |
directory |
Required. Specifies the path to the new current directory. |
Return Value: |
Returns |
PHP Version: |
4.0+ |