PHP realpath() Function
In this chapter you will learn:
- Definition for PHP realpath() Function
- Syntax for PHP realpath() Function
- Parameter for PHP realpath() Function
- Return for PHP realpath() Function
- Example - Get the real path for a relative path
Definition
This function removes all symbolic links (like '/./', '/../' and extra '/') and returns the absolute pathname.
Syntax
PHP realpath() Function has the following syntax.
realpath(path)
Parameter
Parameter | Is Required | Description |
---|---|---|
path | Required. | Path to check |
Return
This function returns FALSE on failure.
The realpath() function returns the absolute pathname.
Example
Get the real path for a relative path
<?php
echo realpath("..\..\test.txt");
?>
Next chapter...
What you will learn in the next chapter:
- Definition for PHP rename() Function
- Syntax for PHP rename() Function
- Parameter for PHP rename() Function
- Return for PHP rename() Function
- Note for PHP rename() Function
- Example - renames a file or directory
Home » PHP Tutorial » PHP File Functions