PHP getcwd() function with example

PHP getcwd() work: Here, we will find out about the PHP getcwd() work with its syntax, parameters, returns a type, and example.

PHP getcwd() work

The full type of getcwd is “Get Current Working Directory”, the capacity getcwd() is utilized to get the name of the present working catalogue, it doesn’t acknowledge any parameter and returns the present working index.

Syntax:

getcwd(); 

Parameter(s):

  • It doesn’t acknowledge any parameter.

Return value:

On the off chance that capacity execution is the achievement, it restores the present working catalogue and it returns “False” if work execution is fizzled.

Example: PHP code to get the name of the present working registry

<?php
$result = getcwd();
echo "current working directory is: ".$result."<br/>";
?>

Output:

current working directory is: /home

Leave a Comment

error: Alert: Content is protected!!