3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo $phpdate = strtotime('-1 day'); echo PHP_EOL; echo $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:i A", $phpdate); } else if(date('Y-m-d', strtotime('-1 day')) == date('Y-m-d', $phpdate)) { echo 2; return "Yesterday at" . date("g:i A", $phpdate); } else { echo 3; return date("m-d-Y g:ia", $phpdate); } } echo d($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
1387323641 2013-12-18 00:40:412Yesterday at12:40 AM
Output for 5.0.2
1387321200 2013-12-18 00:00:002Yesterday at12:00 AM
Output for 5.0.0 - 5.0.1
1387321200 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/LsCRR on line 5 PHP_EOL2013-12-18 00:00:002Yesterday at12:00 AM
Output for 4.3.0 - 4.3.9
1387323641 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/LsCRR on line 5 PHP_EOL2013-12-18 00:40:412Yesterday at12:40 AM