PHP getcwd() function

Example

Get the current working directory:

<?php
echo getcwd()
?>

Result:

/home/php

Definition and Usage

The getcwd() function returns the current working directory.

Syntax

getcwd();

Technical Details

Return Value: If successful, it returns the current working directory. If failed, it returns FALSE.
PHP Version: 4.0+