3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo $phpdate = strtotime('now'); echo PHP_EOL; echo $mysqldate = date('Y-m-d H:i:s', $phpdate); function formatDate($time) { if ($time >= strtotime("today")) { return date("g:i A", $time); } elseif ($time >= strtotime("yesterday")) { return "Yesterday at " . date("g:i A", $time); } else { return date("M j, Y", $time); } } echo formatDate($phpdate); ?>
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.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 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, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
1387403018 2013-12-18 22:43:3810:43 PM
Output for 7.3.32 - 7.3.33, 7.4.26, 8.0.13
1387403018 2013-12-18 21:43:389:43 PM
Output for 5.0.2
1387321200 2013-12-18 00:00:0012:00 AM
Output for 5.0.0 - 5.0.1
1387321200 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/RiUDD on line 5 PHP_EOL2013-12-18 00:00:0012:00 AM
Output for 4.3.0 - 4.3.9
1387403018 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/RiUDD on line 5 PHP_EOL2013-12-18 22:43:3810:43 PM

preferences:
260.24 ms | 401 KiB | 384 Q