1--TEST-- 2Test getdate() function : usage variation - Passing strings containing numbers 3--FILE-- 4<?php 5/* Prototype : array getdate([int timestamp]) 6 * Description: Get date/time information 7 * Source code: ext/date/php_date.c 8 * Alias to functions: 9 */ 10 11echo "*** Testing getdate() : usage variation ***\n"; 12 13date_default_timezone_set("Asia/Calcutta"); 14 15//Timezones with required data for date_sunrise 16$inputs = array ( 17 'String 0' => '0', 18 'String 10.5' => "10.5", 19 'String -10.5' => '-10.5', 20); 21 22// loop through each element of the array for timestamp 23foreach($inputs as $key => $value) { 24 echo "\n--$key--\n"; 25 var_dump( getdate($value) ); 26}; 27?> 28===DONE=== 29--EXPECTF-- 30*** Testing getdate() : usage variation *** 31 32--String 0-- 33array(11) { 34 ["seconds"]=> 35 int(0) 36 ["minutes"]=> 37 int(30) 38 ["hours"]=> 39 int(5) 40 ["mday"]=> 41 int(1) 42 ["wday"]=> 43 int(4) 44 ["mon"]=> 45 int(1) 46 ["year"]=> 47 int(1970) 48 ["yday"]=> 49 int(0) 50 ["weekday"]=> 51 string(8) "Thursday" 52 ["month"]=> 53 string(7) "January" 54 [0]=> 55 int(0) 56} 57 58--String 10.5-- 59array(11) { 60 ["seconds"]=> 61 int(10) 62 ["minutes"]=> 63 int(30) 64 ["hours"]=> 65 int(5) 66 ["mday"]=> 67 int(1) 68 ["wday"]=> 69 int(4) 70 ["mon"]=> 71 int(1) 72 ["year"]=> 73 int(1970) 74 ["yday"]=> 75 int(0) 76 ["weekday"]=> 77 string(8) "Thursday" 78 ["month"]=> 79 string(7) "January" 80 [0]=> 81 int(10) 82} 83 84--String -10.5-- 85array(11) { 86 ["seconds"]=> 87 int(50) 88 ["minutes"]=> 89 int(29) 90 ["hours"]=> 91 int(5) 92 ["mday"]=> 93 int(1) 94 ["wday"]=> 95 int(4) 96 ["mon"]=> 97 int(1) 98 ["year"]=> 99 int(1970) 100 ["yday"]=> 101 int(0) 102 ["weekday"]=> 103 string(8) "Thursday" 104 ["month"]=> 105 string(7) "January" 106 [0]=> 107 int(-10) 108} 109===DONE=== 110