1--TEST-- 2Test chdir() function : basic functionality 3--FILE-- 4<?php 5/* 6 * Test basic functionality of chdir() with absolute and relative paths 7 */ 8 9echo "*** Testing chdir() : basic functionality ***\n"; 10$base_dir_path = __DIR__; 11 12$level1_one_dir_name = "level1_one"; 13$level1_one_dir_path = "$base_dir_path/$level1_one_dir_name"; 14 15$level1_two_dir_name = "level1_two"; 16$level1_two_dir_path = "$base_dir_path/$level1_one_dir_name/$level1_two_dir_name"; 17 18// create directories 19mkdir($level1_one_dir_path); 20mkdir($level1_two_dir_path); 21 22echo "\n-- Testing chdir() with absolute path: --\n"; 23chdir($base_dir_path); 24var_dump(chdir($level1_one_dir_path)); 25var_dump(getcwd()); 26 27echo "\n-- Testing chdir() with relative paths: --\n"; 28var_dump(chdir($level1_two_dir_name)); 29var_dump(getcwd()); 30?> 31--CLEAN-- 32<?php 33$file_path = __DIR__; 34rmdir("$file_path/level1_one/level1_two"); 35rmdir("$file_path/level1_one"); 36?> 37--EXPECTF-- 38*** Testing chdir() : basic functionality *** 39 40-- Testing chdir() with absolute path: -- 41bool(true) 42string(%d) "%slevel1_one" 43 44-- Testing chdir() with relative paths: -- 45bool(true) 46string(%d) "%slevel1_one%elevel1_two" 47