function er() {
date_default_timezone_set('Europe/Moscow');
$currentTime = date("H:i");
$list = schedule();
foreach ($list as $key => $val) {
if(strtotime($currentTime) > strtotime($key)) {
continue;
}
echo $key.'\n'. $val[0];
return( $val );
}
print_r( current( $list ) );
}
Array
(
[07:10] => Array
(
[0] => Утро
[1] => http://vue.by/wp-content/uploads/2018/10/2.jpg
)
[07:12] => Array
(
[0] => Приветы
[1] => http://vue.by/wp-content/uploads/2018/10/4.jpg
)
[08:10] => Array
(
[0] => Утро
[1] => http://vue.by/wp-content/uploads/2018/10/2.jpg
)
[08:19] => Array
(
[0] => Приветы
[1] => http://vue.by/wp-content/uploads/2018/10/4.jpg
)
[09:19] => Array
(
[0] => Звезда
[1] => http://vue.by/wp-content/uploads/2018/10/1-1.jpg
)
[10:15] => Array
(
[0] => Утро
[1] => http://vue.by/wp-content/uploads/2018/10/2.jpg
)
[10:35] => Array
(
[0] => Приветы
[1] => http://vue.by/wp-content/uploads/2018/10/4.jpg
)
[11:46] => Array
(
[0] => Утро
[1] => http://vue.by/wp-content/uploads/2018/10/2.jpg
)
[11:56] => Array
(
[0] => Приветы
[1] => http://vue.by/wp-content/uploads/2018/10/4.jpg
)
[12:42] => Array
(
[0] => Звезда
[1] => http://vue.by/wp-content/uploads/2018/10/1-1.jpg
)
[14:00] => Array
(
[0] => Утро
[1] => http://vue.by/wp-content/uploads/2018/10/2.jpg
)
[18:49] => Array
(
[0] => Звезда
[1] => http://vue.by/wp-content/uploads/2018/10/1-1.jpg
)
)
function er() {
date_default_timezone_set('Europe/Moscow');
$currentTime = date("H:i");
$list = schedule();
foreach ($list as $key => $val) {
if($currentTime < $key) {
continue;
}
return $val;
}
return current( $list );
}
[08:19] => Array
(
[0] => Приветы
[1] => http://vue.by/wp-content/uploads/2018/10/4.jpg
)
[09:19] => Array
(
[0] => Звезда
[1] => http://vue.by/wp-content/uploads/2018/10/1-1.jpg
)
(
[0] => Утро
[1] => http://vue.by/wp-content/uploads/2018/10/2.jpg
)