- preg_match: documentation ( source)
- str_replace: documentation ( source)
- explode: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
- preg_replace: documentation ( source)
<?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]))
// {print_r($matches);}
{preg_replace('/[^0-9]/', '%%', $newCeva[$i]);}
echo $i . " " . $newCeva[$i] . "\n";
}
?>