1--TEST-- 2Test localtime() function : usage variation - Passing hexa decimal values to timestamp. 3--FILE-- 4<?php 5/* Prototype : array localtime([int timestamp [, bool associative_array]]) 6 * Description: Returns the results of the C system call localtime as an associative array 7 * if the associative_array argument is set to 1 other wise it is a regular array 8 * Source code: ext/date/php_date.c 9 * Alias to functions: 10 */ 11 12echo "*** Testing localtime() : usage variation ***\n"; 13 14date_default_timezone_set("UTC"); 15// Initialise function arguments not being substituted (if any) 16$is_associative = true; 17 18//array of values to iterate over 19$inputs = array( 20 21 'Hexa-decimal 0' => 0x0, 22 'Hexa-decimal 10' => 0xA, 23 'Hexa-decimal -10' => -0XA 24); 25 26foreach($inputs as $key =>$value) { 27 echo "\n--$key--\n"; 28 var_dump( localtime($value) ); 29 var_dump( localtime($value, $is_associative) ); 30} 31 32?> 33===DONE=== 34--EXPECTF-- 35*** Testing localtime() : usage variation *** 36 37--Hexa-decimal 0-- 38array(9) { 39 [0]=> 40 int(0) 41 [1]=> 42 int(0) 43 [2]=> 44 int(0) 45 [3]=> 46 int(1) 47 [4]=> 48 int(0) 49 [5]=> 50 int(70) 51 [6]=> 52 int(4) 53 [7]=> 54 int(0) 55 [8]=> 56 int(0) 57} 58array(9) { 59 ["tm_sec"]=> 60 int(0) 61 ["tm_min"]=> 62 int(0) 63 ["tm_hour"]=> 64 int(0) 65 ["tm_mday"]=> 66 int(1) 67 ["tm_mon"]=> 68 int(0) 69 ["tm_year"]=> 70 int(70) 71 ["tm_wday"]=> 72 int(4) 73 ["tm_yday"]=> 74 int(0) 75 ["tm_isdst"]=> 76 int(0) 77} 78 79--Hexa-decimal 10-- 80array(9) { 81 [0]=> 82 int(10) 83 [1]=> 84 int(0) 85 [2]=> 86 int(0) 87 [3]=> 88 int(1) 89 [4]=> 90 int(0) 91 [5]=> 92 int(70) 93 [6]=> 94 int(4) 95 [7]=> 96 int(0) 97 [8]=> 98 int(0) 99} 100array(9) { 101 ["tm_sec"]=> 102 int(10) 103 ["tm_min"]=> 104 int(0) 105 ["tm_hour"]=> 106 int(0) 107 ["tm_mday"]=> 108 int(1) 109 ["tm_mon"]=> 110 int(0) 111 ["tm_year"]=> 112 int(70) 113 ["tm_wday"]=> 114 int(4) 115 ["tm_yday"]=> 116 int(0) 117 ["tm_isdst"]=> 118 int(0) 119} 120 121--Hexa-decimal -10-- 122array(9) { 123 [0]=> 124 int(50) 125 [1]=> 126 int(59) 127 [2]=> 128 int(23) 129 [3]=> 130 int(31) 131 [4]=> 132 int(11) 133 [5]=> 134 int(69) 135 [6]=> 136 int(3) 137 [7]=> 138 int(364) 139 [8]=> 140 int(0) 141} 142array(9) { 143 ["tm_sec"]=> 144 int(50) 145 ["tm_min"]=> 146 int(59) 147 ["tm_hour"]=> 148 int(23) 149 ["tm_mday"]=> 150 int(31) 151 ["tm_mon"]=> 152 int(11) 153 ["tm_year"]=> 154 int(69) 155 ["tm_wday"]=> 156 int(3) 157 ["tm_yday"]=> 158 int(364) 159 ["tm_isdst"]=> 160 int(0) 161} 162===DONE=== 163