Tutorials Point


  Learning PHP
  Advanced PHP
  PHP Function Reference
  PHP Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

PHP Function chdir()


previous

Advertisements

Syntax

bool chdir ( string $directory )

Definition and Usage

Changes PHP's current directory to the passed directory.

Paramters

ParameterDescription
directoryRequired. The new current directory

Return Value

Returns TRUE on success or FALSE on failure.

Example

Following is the usage of this function:

<?php
// current directory
echo getcwd() . "\n";

chdir('html');

// current directory
echo getcwd() . "\n";
?> 

This will produce following result:

/home/tutorialspoint
/home/tutorialspoint/html

previous Printer Friendly

Advertisements


  

Advertisements