1--TEST-- 2finfo_file(): Testing mime types 3--SKIPIF-- 4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> 5--FILE-- 6<?php 7 8$fp = finfo_open(FILEINFO_MIME_TYPE); 9$results = array(); 10 11foreach (glob(__DIR__ . "/resources/*") as $filename) { 12 if (is_file($filename)) { 13 $results["$filename"] = finfo_file($fp, $filename); 14 } 15} 16ksort($results); 17 18var_dump($results); 19?> 20--EXPECTF-- 21array(9) { 22 ["%s/resources/dir.zip"]=> 23 string(15) "application/zip" 24 ["%s/resources/test.awk"]=> 25 string(10) "text/plain" 26 ["%s/resources/test.bmp"]=> 27 string(14) "image/x-ms-bmp" 28 ["%s/resources/test.gif"]=> 29 string(9) "image/gif" 30 ["%s/resources/test.jpg"]=> 31 string(10) "image/jpeg" 32 ["%s/resources/test.mp3"]=> 33 string(10) "audio/mpeg" 34 ["%s/resources/test.pdf"]=> 35 string(15) "application/pdf" 36 ["%s/resources/test.png"]=> 37 string(9) "image/png" 38 ["%s/resources/test.ppt"]=> 39 string(29) "application/vnd.ms-powerpoint" 40} 41