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.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions