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)) { echo 1; return 'Today at ' . date("g:ia", $phpdate); } else if(date('Y-m-d', strtotime('-1 day')) == date('Y-m-d', $phpdate)) { echo 2; return "Yesterday at" + date("g:ia", $phpdate); } else { echo 3; return date("m-d-Y g:ia", $phpdate); } } echo d($phpdate); ?>
Output for 7.1.0
1387323492 2 Warning: A non-numeric value encountered in /in/VrNEO on line 15 Notice: A non well formed numeric value encountered in /in/VrNEO on line 15 12
Output for 4.3.10 - 4.4.9, 5.0.3 - 5.4.15, 5.4.17 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.0.14
1387323492 212
Output for 5.4.16
1387323493 212
Output for 5.0.2
1387321200 212
Output for 5.0.0 - 5.0.1
1387321200 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VrNEO on line 5 PHP_EOL212
Output for 4.3.0 - 4.3.9
1387323492 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VrNEO on line 5 PHP_EOL212