chdir('subdirectory');
chdir('/var/www/html');
$current_dir = getcwd();This code will get the current working directory and store it in the $current_dir variable. The "chdir" function is a part of the PHP Standard Library, which is bundled with PHP installation by default.