PHP chdir() Function

PHP closedir() Function
PHP chroot() Function

In this article, you will learn how to change the current directory in PHP. The chdir() function in PHP changes the current directory.

what is the syntax CHROOT() of the function in php?

chdir(directory)
ParameterDescription
directoryRequired. Specifies the new current directory
PHP CHDIR() method

examples of the CHROOT() function

Example 1. In this example, we change the current directory.

<?php
// Get current directory
echo getcwd() . "<br>";

// Change directory
chdir("images");

// Get current directory
echo getcwd();
?>
PHP closedir() Function
PHP chroot() Function

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top