Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

chdir

Description

The chdir of Directory for PHP changes a 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
HomeMenu