3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dp = new DatePeriod(new DateTime('2010-01-01'), new DateInterval('P1D'), 2); $dp = new DateInterval('P2Y3W1D'); $r = new ReflectionObject($dp); $arr = (array)$dp; // cast to array to see the values of propeties echo "Properties:\r\n"; foreach($r->getProperties() as $v) { echo $v->getName()."\r\n"; } echo "\r\n"; echo "Methods:\r\n"; foreach($r->getMethods() as $v) { echo $v->getName()."\r\n"; } echo "\r\n"; echo "Array cast:\r\n"; echo strtr(print_r($arr, true), "\0", '_');
Output for 7.1.0
Properties: y m d h i s f weekday weekday_behavior first_last_day_of invert days special_type special_amount have_weekday_relative have_special_relative Methods: __construct __wakeup __set_state format createFromDateString Array cast: Array ( [y] => 2 [m] => 0 [d] => 1 [h] => 0 [i] => 0 [s] => 0 [f] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.3.27 - 5.3.29, 5.4.17 - 5.6.28, 7.0.0 - 7.0.14
Properties: y m d h i s weekday weekday_behavior first_last_day_of invert days special_type special_amount have_weekday_relative have_special_relative Methods: __construct __wakeup __set_state format createFromDateString Array cast: Array ( [y] => 2 [m] => 0 [d] => 1 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for hhvm-3.10.0 - 3.12.0
Properties: Methods: __construct __get __set createFromDateString format Array cast: Array ( )
Output for 5.3.9 - 5.3.26, 5.4.0 - 5.4.16
Properties: y m d h i s invert days Methods: __construct __wakeup __set_state format createFromDateString Array cast: Array ( [y] => 2 [m] => 0 [d] => 1 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => )
Output for 5.3.3 - 5.3.8
Properties: y m d h i s invert days Methods: __construct format createFromDateString Array cast: Array ( [y] => 2 [m] => 0 [d] => 1 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => )
Output for 5.3.0 - 5.3.2
Properties: y m d h i s invert days Methods: __construct format createFromDateString Array cast: Array ( [y] => 2 [m] => 0 [d] => 1 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 0 )
Output for 5.0.0 - 5.2.17
Fatal error: Class 'DatePeriod' not found in /in/VkUAS on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: dateperiod in /in/VkUAS on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: dateperiod in /in/VkUAS on line 3