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