2 /* Prototype : string gmdate(string format [, long timestamp])
3 * Description: Format a GMT date/time
4 * Source code: ext/date/php_date.c
8 echo "*** Testing gmdate() : usage variation ***\n";
10 // Initialise all required variables
11 date_default_timezone_set('UTC');
12 $timestamp = mktime(8, 8, 8, 8, 8, 2008);
14 //get an unset variable
18 // define some classes
19 class classWithToString
21 public function __toString() {
22 return "Class A object";
26 class classWithoutToString
36 $index_array = array (1, 2, 3);
37 $assoc_array = array ('one' => 1, 'two' => 2);
39 //array of values to iterate over
46 'int -12345' => -12345,
50 'float -10.5' => -10.5,
51 'float 12.3456789000e10' => 12.3456789000e10
,
52 'float -12.3456789000e10' => -12.3456789000e10
,
56 'empty array' => array(),
57 'int indexed array' => $index_array,
58 'associative array' => $assoc_array,
59 'nested arrays' => array('foo', $index_array, $assoc_array),
62 'uppercase NULL' => NULL,
63 'lowercase null' => null,
66 'lowercase true' => true,
67 'lowercase false' =>false,
68 'uppercase TRUE' =>TRUE,
69 'uppercase FALSE' =>FALSE,
72 'empty string DQ' => "",
73 'empty string SQ' => '',
76 'instance of classWithToString' => new classWithToString(),
77 'instance of classWithoutToString' => new classWithoutToString(),
80 'undefined var' => @$undefined_var,
83 'unset var' => @$unset_var,
86 // loop through each element of the array for format
88 foreach($inputs as $key =>$value) {
90 var_dump( gmdate($value, $timestamp) );
91 var_dump( gmdate($value) );