3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDuration(array $times) { $startTime = new DateTime($times[0]); $endTime = $startTime->diff(new DateTime($times[1])); return "{$endTime->h}:".$endTime->format('%I'); } echo getDuration(array('1:00pm', '7:00pm'));

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
154.28 ms | 2800 KiB | 9 Q