SELECT *
FROM (
SELECT `user_id`
FROM `user_dats`
WHERE `dat` IN (1, 2, 3, 4, 5)
GROUP BY `user_id`
) AS `uid`
JOIN `table` ON `uid`.`user_id` = `table`.`id`
<?php
$begin = new DateTime('09:00');
$end = new DateTime('21:00');
$intervals = array(
array(new DateTime('10:00'), new DateTime('10:15')),
array(new DateTime('10:15'), new DateTime('11:45')),
array(new DateTime('12:30'), new DateTime('16:00'))
);
$time = 90;
function checkInterval($begin, $end, $time) {
$intervalDiff = $begin->diff($end);
$intervalMinutes = $intervalDiff->h * 60 + $intervalDiff->i;
if ($intervalMinutes >= $time) {
echo $begin->format('H:i'), ' - ', $end->format('H:i'), "\n";
}
}
$intervalStart = $begin;
foreach ($intervals as $interval) {
checkInterval($intervalStart, $interval[0], $time);
$intervalStart = $interval[1];
}
checkInterval($intervalStart, $end, $time);
[
'width=5' => [0, 3],
'ht=3' => [0, 3],
'len=10' => [0],
'name=circ' => [1, 2],
'rad=5' => [1, 2].
'name=sqr' => [3]
]
array_intersect([0, 3], [0, 3]) = [0, 3]
[1, 2]
[3]
array_intersect([0, 3], [0]) = [0]
For any of the types integer, float, string, boolean and resource, converting a value to an array results in an array with a single element with index zero and the value of the scalar which was converted. In other words, (array)$scalarValue is exactly the same as array($scalarValue).
Attempting to access an array key which has not been defined is the same as accessing any other undefined variable: an E_NOTICE-level error message will be issued, and the result will be NULL.