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)) { return 'Today at ' . date("g:ia", $phpdate); } else if(date('Y-m-d', strtotime('-1 day')) == date('Y-m-d', $phpdate)) { return "Yesterday at" + date("g:ia", $phpdate); } else { return date("m-d-Y g:ia", $phpdate); } } echo d($phpdate); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
1387323325 Fatal error: Uncaught TypeError: Unsupported operand types: string + string in /in/ZNhha:13 Stack trace: #0 /in/ZNhha(21): d(1387323325) #1 {main} thrown in /in/ZNhha on line 13
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
1387323325 Warning: A non-numeric value encountered in /in/ZNhha on line 13 Notice: A non well formed numeric value encountered in /in/ZNhha on line 13 12
Output for 7.3.32 - 7.3.33, 7.4.26
1387323325 Warning: A non-numeric value encountered in /in/ZNhha on line 13 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.38, 5.4.40 - 5.4.45, 5.5.0 - 5.5.7, 5.5.9 - 5.5.21, 5.5.24 - 5.5.38, 5.6.0 - 5.6.5, 5.6.7 - 5.6.40, 7.0.0 - 7.0.33
1387323325 12
Output for 5.4.39, 5.5.8, 5.5.22 - 5.5.23, 5.6.6
1387323326 12
Output for 5.0.2
1387321200 12
Output for 5.0.0 - 5.0.1
1387321200 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ZNhha on line 5 PHP_EOL12
Output for 4.3.0 - 4.3.9
1387323325 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ZNhha on line 5 PHP_EOL12

preferences:
206.22 ms | 401 KiB | 456 Q