1--TEST-- 2Test image_type_to_mime_type() function : usage variations - Pass decimal, octal, and hexadecimal values as imagetype 3--FILE-- 4<?php 5/* Prototype : string image_type_to_mime_type(int imagetype) 6 * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype 7 * Source code: ext/standard/image.c 8 */ 9 10echo "*** Testing image_type_to_mime_type() : usage variations ***\n"; 11 12error_reporting(E_ALL ^ E_NOTICE); 13$values = array ( 14 //Decimal values 15 0, 16 1, 17 12345, 18 -12345, 19 20 //Octal values 21 02, 22 010, 23 030071, 24 -030071, 25 26 //Hexadecimal values 27 0x0, 28 0x1, 29 0xABCD, 30 -0xABCD 31); 32 33// loop through each element of the array for imagetype 34$iterator = 1; 35foreach($values as $value) { 36 echo "\n-- Iteration $iterator --\n"; 37 var_dump( image_type_to_mime_type($value) ); 38 $iterator++; 39}; 40?> 41===DONE=== 42--EXPECT-- 43*** Testing image_type_to_mime_type() : usage variations *** 44 45-- Iteration 1 -- 46string(24) "application/octet-stream" 47 48-- Iteration 2 -- 49string(9) "image/gif" 50 51-- Iteration 3 -- 52string(24) "application/octet-stream" 53 54-- Iteration 4 -- 55string(24) "application/octet-stream" 56 57-- Iteration 5 -- 58string(10) "image/jpeg" 59 60-- Iteration 6 -- 61string(10) "image/tiff" 62 63-- Iteration 7 -- 64string(24) "application/octet-stream" 65 66-- Iteration 8 -- 67string(24) "application/octet-stream" 68 69-- Iteration 9 -- 70string(24) "application/octet-stream" 71 72-- Iteration 10 -- 73string(9) "image/gif" 74 75-- Iteration 11 -- 76string(24) "application/octet-stream" 77 78-- Iteration 12 -- 79string(24) "application/octet-stream" 80===DONE=== 81