PHP Tutorial - PHP getcwd() function






Definition

To find the current working directory, use getcwd().

Syntax

PHP getcwd() function has the following syntax.

getcwd();

Return

getcwd() returns true on success or false on failure.

Example

Get current working directory


<?PHP
   $original_dir = getcwd();
   print($original_dir);
?>

The code above generates the following result.