3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Properties: y m d h i s f invert days from_string Methods: __construct createFromDateString format __serialize __unserialize __wakeup __set_state Array cast: Array ( [y] => 2 [m] => 0 [d] => 22 [h] => 0 [i] => 0 [s] => 0 [f] => 0 [invert] => 0 [days] => [from_string] => )
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
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 createFromDateString format __wakeup __set_state Array cast: Array ( [y] => 2 [m] => 0 [d] => 22 [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 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
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.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20
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 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.0.5, 5.1.0 - 5.1.6, 5.2.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.3.11, 4.4.0 - 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

preferences:
213.21 ms | 401 KiB | 358 Q