3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo $phpdate = strtotime('-2 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:i A", $phpdate); } } echo d($phpdate); ?>
Output for 4.3.10 - 4.4.9, 5.0.3 - 5.5.20, 5.5.22 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
1387237309 2013-12-17 00:41:49312-17-2013 12:41 AM
Output for 5.5.21
1387237308 2013-12-17 00:41:48312-17-2013 12:41 AM
Output for 5.0.2
1387234800 2013-12-17 00:00:00312-17-2013 12:00 AM
Output for 5.0.0 - 5.0.1
1387234800 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BH0Lv on line 5 PHP_EOL2013-12-17 00:00:00312-17-2013 12:00 AM
Output for 4.3.0 - 4.3.9
1387237309 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BH0Lv on line 5 PHP_EOL2013-12-17 00:41:49312-17-2013 12:41 AM