w3resource logo


PHP : chdir function

PHP : chdir() function

<<PreviousNext>>

Description

The chdir() function is used to change the current working directory to a specified dir.

Version

(PHP 4 and above)

Syntax

chdir(dir_name)

Parameter

Name Description Required /
Optional
Type
dir_name The new current directory. Required String

Return value

TRUE on success or FALSE on failure.

Value Type : Boolean.

Example :

<?php
echo getcwd() .'<br>';
echo "Change to the 'test' directory".'<br>';
chdir('test');
echo getcwd() ;
?>

See also

PHP Function Reference

<<PreviousNext>>

Rate this tutorial


Your Rating: not set

Share this tutorial

RSS Feed