3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo $phpdate = strtotime('-1 day'); echo PHP_EOL; $mysqldate = date('Y-m-d H:i:s', $phpdate); function d($phpdate) { if(date('Y-m-d') == date('Y-m-d', $phpdate)) { echo 1; return 'Today at ' . date("g:ia", $phpdate); } else if(date('Y-m-d', strtotime('-1 day')) == date('Y-m-d', $phpdate)) { echo 2; return "Yesterday at" + date("g:ia", $phpdate); } else { echo 3; return date("m-d-Y g:ia", $phpdate); } } echo d($phpdate); ?>
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.6
1387323492 2 Fatal error: Uncaught TypeError: Unsupported operand types: string + string in /in/VrNEO:15 Stack trace: #0 /in/VrNEO(24): d(1387323492) #1 {main} thrown in /in/VrNEO on line 15
Process exited with code 255.
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
1387323492 2 Warning: A non-numeric value encountered in /in/VrNEO on line 15 Notice: A non well formed numeric value encountered in /in/VrNEO on line 15 12
Output for 7.3.32 - 7.3.33, 7.4.26
1387323492 2 Warning: A non-numeric value encountered in /in/VrNEO on line 15 11
Output for 4.3.10 - 4.3.11, 4.4.0 - 4.4.9, 5.0.3 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.15, 5.4.17 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20
1387323492 212
Output for 5.4.16
1387323493 212
Output for 5.0.2
1387321200 212
Output for 5.0.0 - 5.0.1
1387321200 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VrNEO on line 5 PHP_EOL212
Output for 4.3.0 - 4.3.9
1387323492 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VrNEO on line 5 PHP_EOL212

preferences:
200.08 ms | 401 KiB | 351 Q