PHP chdir() Function

P
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

Add comment

Tutor Network

Share this

Learn PHP from A to Z