Home » PHP

PHP getcwd() function with example

PHP getcwd() function: Here, we are going to learn about the PHP getcwd() function with its syntax, parameters, returns type, and example.
Submitted by IncludeHelp, on August 11, 2019

PHP getcwd() function

The full form of getcwd is "Get Current Working Directory", the function getcwd() is used to get the name of the current working directory, it does not accept any parameter and returns the current working directory.




  • It does not accept any parameter.

Return value:

If function execution is the success, it returns the current working directory and it returns "FALSE" if function execution is failed.

Example: PHP code to get the name of the current working directory

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


current working directory is: /home

Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.