PHP getcwd() function
In this chapter you will learn:
- Definition for PHP getcwd() function
- Syntax for PHP getcwd() function
- Return for PHP getcwd() function
- Example - Get current working directory
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.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP glob() Function
- Syntax for PHP glob() Function
- Parameter for PHP glob() Function
- Return for PHP glob() Function
- Example - returns an array of filenames or directories matching a specified pattern
Home » PHP Tutorial » PHP File Functions