3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function fullstrtotime ($time) { return strtotime(str_replace(array(" at"), "", $time)); } $myS = "tomorrow at 5PM"; $myX = fullstrtotime($myS); echo "hei" . $myX . "\n"; $myF = date('d m Y H:i',$myX) ; echo "heiF" . $myF . "\n"; $str = "Dinner at 5pm at Shanghai Restaurant"; $newCeva = explode(" ",$str); $i = 0; for($i=0;$i<count($newCeva);$i++) { // {print_r($matches);} $pattern = '/ (\d+)(\w+)/i'; $replacement = '%%%'; echo preg_replace($pattern, $replacement, $newCeva[$i]); // {preg_replace('/[^0-9]/', '%%', $newCeva[$i]);} echo $i . " " . $newCeva[$i] . "\n"; } ?>
based on 8av1B
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
hei1514044800 heiF23 12 2017 17:00 Dinner0 Dinner at1 at 5pm2 5pm at3 at Shanghai4 Shanghai Restaurant5 Restaurant