3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo $phpdate = strtotime('-1 day'); echo PHP_EOL; $mysqldate = date('Y-m-d H:i:s', $phpdate); function d($phpdate) { if(date('Y-m-d') == date('Y-m-d', $phpdate)) { return 'Today at ' . date("g:ia", $phpdate); } else if(date('Y-m-d', strtotime('-1 day')) == date('Y-m-d', $phpdate)) { return "Yesterday at" + date("g:ia", $phpdate); } else { return date("m-d-Y g:ia", $phpdate); } } echo d($phpdate); ?>
Output for 7.1.0
1387323325 Warning: A non-numeric value encountered in /in/ZNhha on line 13 Notice: A non well formed numeric value encountered in /in/ZNhha on line 13 12
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.0.14
1387323325 12
Output for 5.0.2
1387321200 12
Output for 5.0.0 - 5.0.1
1387321200 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ZNhha on line 5 PHP_EOL12
Output for 4.3.0 - 4.3.9
1387323325 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ZNhha on line 5 PHP_EOL12