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)
Parameter | Description |
---|---|
directory | Required. Specifies the new current directory |
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();
?>