2 /* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day )
3 * Description: Resets the current date of the DateTime object to a different date.
4 * Source code: ext/date/php_date.c
5 * Alias to functions: DateTime::setDate
8 echo "*** Testing date_date_set() : usage variation - unexpected values to first argument \$object***\n";
10 //Set the default time zone
11 date_default_timezone_set("Europe/London");
13 //get an unset variable
17 // define some classes
18 class classWithToString
20 public function __toString() {
21 return "Class A object";
25 class classWithoutToString
35 $index_array = array (1, 2, 3);
36 $assoc_array = array ('one' => 1, 'two' => 2);
39 $file_handle = fopen(__FILE__
, 'r');
41 //array of values to iterate over
48 'int -12345' => -12345,
52 'float -10.5' => -10.5,
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 'string DQ' => "string",
77 'string SQ' => 'string',
78 'mixed case string' => "sTrInG",
79 'heredoc' => $heredoc,
82 'instance of classWithToString' => new classWithToString(),
83 'instance of classWithoutToString' => new classWithoutToString(),
86 'undefined var' => @$undefined_var,
89 'unset var' => @$unset_var,
92 'resource' => $file_handle
99 foreach($inputs as $variation =>$object) {
100 echo "\n-- $variation --\n";
101 var_dump( date_date_set($object, $year, $month, $day) );
104 // closing the resource
105 fclose( $file_handle );