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++) { if(preg_match('!\d+!', $newCeva[$i])) echo 'found num!'; // {print_r($matches);} {preg_replace('/[^0-9]/', '%%', $newCeva[$i]);} echo $i . " " . $newCeva[$i] . "\n"; } ?>
based on k0t2K
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 0 Dinner 1 at found num!2 5pm 3 at 4 Shanghai 5 Restaurant