3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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.4.9, 5.0.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
1387403018 2013-12-18 22:43:3810: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