R
R
redd_i2020-04-17 14:13:03
PHP
redd_i, 2020-04-17 14:13:03

How to get the right data?

Hello. We have
$time = "from 10:00 to 22:00";
Is it possible to get data with a variable like this, for example
$timef = "10:00";
$timel = "22:00";

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-04-17
@redd_i

preg_match_all('~\d\d:\d\d~', $time, $match);
list($timef, $timel) = $match[0];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question