• PHP Video Tutorials

PHP - Function getcwd()



Syntax

string getcwd ( void );

Definition and Usage

It gets the current working directory.

Parameters

Sr.No Parameter & Description
1

void

NA

Return Value

It returns the current working directory on success, or FALSE on failure.

Example

Following is the usage of this function −

<?php
   echo getcwd() . "\n";
   
   getcwd('html');
   
   echo getcwd() . "\n";
?> 

This will produce the following result −

/home/tutorialspoint
/home/tutorialspoint/html
php_function_reference.htm
Advertisements