getcwd

string getcwd(void) 

Returns the current working directory of the current PHP instance.

Returns:

Absolute pathname of the current working directory on success; FALSE for all other cases

Description:

getcwd() returns the current working directory of the current instance of PHP. PHP uses the current working directory as the starting point for any path search in which the pathname is not absolute. This means that most function calls that relate to the filesystem will use the current working directory as the directory in which they operate, unless the pathname specified in the function call is absolute.

Version:

From version 4.0

See also:

To set the current working directory:

chdir() 

Example:

Display the current working directory
 <?php ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.