What is Directory chdir in PHP

In this article I am going to explain about chdir function in PHP.
  • 1747

PHP chdir() function

The directory chdir function changes the current directory to a specified directory.

Syntax of chdir function

chdir(directory)

Parameters in chdir function

It has only one parameter:

Parameter Description
directory It defines a new directory.

Example of directory chdir  function

<html>

<body>

 

<?php

echo getcwd(); // it returns current directory

echo "<br/>";

chdir("Dinesh");

echo "<br />";

echo "New directory will be:";

echo "<br/>";

echo getcwd();

?>

 

</body>

</html>


Output:

chdir function.jpg

You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.