PHP chdir() function
Definition
You can change the working directory using chdir().
Syntax
PHP chdir() function syntax has the following syntax.
chdir(newDir)
Parameter
newDir is the new directory to change.
Return
chdir() returns true on success or false on failure.
Example
Change the working directory using chdir()
<?PHP// w w w. j ava 2 s . c o m
$original_dir = getcwd();
chdir("/etc");
$passwd = fopen("passwd", "r");
fclose($passwd);
chdir($original_dir);
?>