3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $baseDate = new DateTime('2017-01-01', new DateTimezone('UTC')); $endDate = clone $baseDate; for($i = 1; $i <= 4; ++$i) { $duration = new DateInterval("PT{($i*15)}M"); $endDate->add($duration); } $totalDuration = $baseDate->diff($endDate); var_dump($totalDuration); echo $totalDuration->format('%a days, %h hours, %i minutes');
based on V6fG8
Output for 7.0.0 - 7.3.0rc3
Fatal error: Uncaught Exception: DateInterval::__construct(): Unknown or bad format (PT{(1*15)}M) in /in/YvumJ:6 Stack trace: #0 /in/YvumJ(6): DateInterval->__construct('PT{(1*15)}M') #1 {main} thrown in /in/YvumJ on line 6
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught exception 'Exception' with message 'DateInterval::__construct: Invalid interval (PT{(1*15)}M)' in /in/YvumJ:6 Stack trace: #0 /in/YvumJ(6): DateInterval->__construct() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Uncaught exception 'Exception' with message 'DateInterval::__construct(): Unknown or bad format (PT{(1*15)}M)' in /in/YvumJ:6 Stack trace: #0 /in/YvumJ(6): DateInterval->__construct('PT{(1*15)}M') #1 {main} thrown in /in/YvumJ on line 6
Process exited with code 255.