chdir

Change directory

Syntax

chdir(string $directory): bool

Parameters

directory

The new current directory

Return

Returns true on success or false on failure.

Examples

1 · Return

<?

$directory = 'public_html';

$return = chdir($directory);

var_export($return);

?>
true

2 · getcwd

<?

echo getcwd() . "\n";

$directory = 'public_html';

chdir($directory);

echo getcwd();

?>
/home/user
/home/user/public_html

chroot

closedir

dir

getcwd

opendir

readdir

rewinddir

scandir

PHP

Home Menu