THE WORLD'S LARGEST WEB DEVELOPER SITE

PHP getcwd() Function

❮ PHP Directory Reference

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: Returns the current working directory on success. FALSE on failure.
PHP Version: 4.0+

❮ PHP Directory Reference