1--TEST-- 2Test pathinfo() function : usage variation 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--FILE-- 6<?php 7/* Prototype : array pathinfo(string path[, int options]) 8 * Description: Returns information about a certain string 9 * Source code: ext/standard/string.c 10 * Alias to functions: 11 */ 12 13echo "*** Testing pathinfo() : usage variation ***\n"; 14 15$testfile = "/usr/include/arpa/inet.h"; 16 17var_dump(pathinfo("./")); 18var_dump(pathinfo("/.")); 19var_dump(pathinfo(".cvsignore")); 20var_dump(pathinfo($testfile, PATHINFO_BASENAME)); 21var_dump(pathinfo($testfile, PATHINFO_FILENAME)); 22var_dump(pathinfo($testfile, PATHINFO_EXTENSION)); 23var_dump(pathinfo($testfile, PATHINFO_DIRNAME)); 24var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_DIRNAME)); 25var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_BASENAME)); 26var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME)); 27var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_BASENAME)); 28var_dump(pathinfo($testfile, PATHINFO_FILENAME|PATHINFO_DIRNAME)); 29var_dump(pathinfo($testfile, PATHINFO_FILENAME|PATHINFO_BASENAME)); 30var_dump(pathinfo($testfile, PATHINFO_DIRNAME|PATHINFO_EXTENSION)); 31var_dump(pathinfo($testfile, PATHINFO_DIRNAME|PATHINFO_BASENAME)); 32 33 34?> 35===DONE=== 36--EXPECTF-- 37*** Testing pathinfo() : usage variation *** 38array(4) { 39 ["dirname"]=> 40 string(1) "." 41 ["basename"]=> 42 string(1) "." 43 ["extension"]=> 44 string(0) "" 45 ["filename"]=> 46 string(0) "" 47} 48array(4) { 49 ["dirname"]=> 50 string(1) "%s" 51 ["basename"]=> 52 string(1) "." 53 ["extension"]=> 54 string(0) "" 55 ["filename"]=> 56 string(0) "" 57} 58array(4) { 59 ["dirname"]=> 60 string(1) "." 61 ["basename"]=> 62 string(10) ".cvsignore" 63 ["extension"]=> 64 string(9) "cvsignore" 65 ["filename"]=> 66 string(0) "" 67} 68string(6) "inet.h" 69string(4) "inet" 70string(1) "h" 71string(17) "/usr/include/arpa" 72string(17) "/usr/include/arpa" 73string(6) "inet.h" 74string(1) "h" 75string(6) "inet.h" 76string(17) "/usr/include/arpa" 77string(6) "inet.h" 78string(17) "/usr/include/arpa" 79string(17) "/usr/include/arpa" 80===DONE===