1--TEST-- 2Test glob() function with relative path 3--FILE-- 4<?php 5$file_path = __DIR__; 6 7// temp dirname used here 8$dir_name = 'glob_test'; 9 10// create temp directory 11mkdir("$file_path/$dir_name"); 12 13// create temp file 14$fp = fopen("$file_path/$dir_name/file.text", "w"); 15fclose($fp); 16 17echo "Testing glob() with relative paths:\n"; 18 19chdir("$file_path/$dir_name"); 20var_dump( glob("./*") ); 21var_dump( glob("../$dir_name/*")); 22 23chdir("$file_path"); 24var_dump( glob("$dir_name/*")); 25var_dump( glob("$dir_name")); 26 27echo "Done\n"; 28?> 29--CLEAN-- 30<?php 31$file_path = __DIR__; 32unlink("$file_path/glob_test/file.text"); 33rmdir("$file_path/glob_test/"); 34?> 35--EXPECT-- 36Testing glob() with relative paths: 37array(1) { 38 [0]=> 39 string(11) "./file.text" 40} 41array(1) { 42 [0]=> 43 string(22) "../glob_test/file.text" 44} 45array(1) { 46 [0]=> 47 string(19) "glob_test/file.text" 48} 49array(1) { 50 [0]=> 51 string(9) "glob_test" 52} 53Done 54