How to get the right data?

Hello. We have
$time = "10:00 to 22:00";
Is it possible to get data variable as the example in this form
$timef = "10:00";
$timel = "22:00";
April 19th 20 at 12:31
1 answer
April 19th 20 at 12:33
Solution
preg_match_all('~\d\d:\d\d~', $time, $match);
list($timef, $timel) = $match[0];
Why not preg_match? - Joanny44 commented on April 19th 20 at 12:36
@Joanny44, keep with preg_match:

preg_match('~s (.*) to (.*)~', $time, $match);
list(, $timef, $timel) = $match;
- curt.Be commented on April 19th 20 at 12:39
Very cool. Thank you for your help - Maximilian.Mayert66 commented on April 19th 20 at 12:42

Find more questions by tags PHP