3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo $phpdate = strtotime('now'); echo PHP_EOL; echo $phpdate = strtotime('-1'); $mysqldate = date('Y-m-d H:i:s', $phpdate); function formatDate($date) { if ($date >= strtotime('today')) { return 'Today at ' . date('g:i A', $date); } elseif ($date >= strtotime('yesterday')) { return 'Yesterday at ' . date('g:i A', $date); } else { return date('M j, Y', $date); } } echo formatDate($phpdate); ?>
Output for 5.1.0 - 7.1.0
1387403331 1387410531Today at 12:48 AM
Output for 4.3.10 - 4.4.9, 5.0.3 - 5.0.5
1387403331 -1Jan 1, 1970
Output for 5.0.2
1387321200 -1Jan 1, 1970
Output for 5.0.0 - 5.0.1
1387321200 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/KeG5T on line 4 PHP_EOL-1Jan 1, 1970
Output for 4.3.0 - 4.3.9
1387403331 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/KeG5T on line 4 PHP_EOL-1Jan 1, 1970