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); echo PHP_EOL; $last_access = $phpdate; $now = time(); echo $last_midnight = $now - ($now % (24*60*60)); echo PHP_EOL; echo strtotime('today'); echo PHP_EOL; function friendlyDate($timestamp) { if ((($t1 = floor($timestamp / 86400)) < ($t2 = floor(time() / 86400)) - 2) || $t1 > $t2) return date("M d Y, h:iA", $timestamp); elseif ($t1 == $t2 - 1) return "Yesterday, " . date("h:iA", $timestamp); elseif ($t1 == $t2) return "Today, " . date("h:iA", $timestamp); } friendlyDate($phpdate); ?>
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
1387586755 2013-12-21 01:45:55 1387411200 1387407600
Output for 4.3.10 - 4.4.9, 5.0.3 - 5.0.5
1387586755 2013-12-21 01:45:55 1387411200 1387413955
Output for 5.0.2
1387580400 2013-12-21 00:00:00 1387411200 1387407600
Output for 5.0.0 - 5.0.1
1387580400 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GR2h0 on line 5 PHP_EOL2013-12-21 00:00:00 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GR2h0 on line 7 PHP_EOL1387411200 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GR2h0 on line 16 PHP_EOL1387407600 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GR2h0 on line 18 PHP_EOL
Output for 4.3.0 - 4.3.9
1387586755 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GR2h0 on line 5 PHP_EOL2013-12-21 01:45:55 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GR2h0 on line 7 PHP_EOL1387411200 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GR2h0 on line 16 PHP_EOL1387413955 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/GR2h0 on line 18 PHP_EOL