3v4l.org

run code in 500+ PHP versions simultaneously
<?php $di = new \DateInterval('P0Y'); $field = 'd'; $i = 1; $di->$field += $i; var_dump($di);
Output for 8.2.0 - 8.2.30, 8.3.0 - 8.3.19, 8.3.21 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
object(DateInterval)#1 (10) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(0) ["s"]=> int(0) ["f"]=> float(0) ["invert"]=> int(0) ["days"]=> bool(false) ["from_string"]=> bool(false) }
Output for 8.3.20

Process exited with code 139.
Output for 8.1.34
object(DateInterval)#1 (16) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(0) ["s"]=> int(0) ["f"]=> float(0) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> bool(false) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }

preferences:
59.72 ms | 858 KiB | 4 Q