3v4l.org

run code in 300+ PHP versions simultaneously
<?php $eachOffDuty = array(); $eachOffDuty['startTime'] = '1499990575'; $eachOffDuty['endTime'] = '1499990575'; $start_stamp = date("c", $eachOffDuty['startTime']); $start_date = new DateTime($start_stamp); $end_stamp = date("c", $eachOffDuty['endTime']); $end_date = new DateTime($end_stamp); print (int)eachOffDuty['startTime']; $duration = round((int)($eachOffDuty['endTime'] - (int)$eachOffDuty['startTime']) / (60*60*24));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught Error: Undefined constant "eachOffDuty" in /in/Bk9DO:9 Stack trace: #0 {main} thrown in /in/Bk9DO on line 9
Process exited with code 255.
Output for 7.3.24 - 7.3.33, 7.4.12 - 7.4.33
Warning: Use of undefined constant eachOffDuty - assumed 'eachOffDuty' (this will throw an Error in a future version of PHP) in /in/Bk9DO on line 9 Warning: Illegal string offset 'startTime' in /in/Bk9DO on line 9 0

preferences:
146.7 ms | 402 KiB | 119 Q