I have an array of dates.. example:
$dates = array('2018-06-01', '2018-06-02', '2018-06-03');
How to find it's exists in between dates without foreach?
Example:
SELECT * FROM table WHERE $dates BETWEEN from AND to;
I solved this question converting the datetime field do unix timestamp in query:
SELECT * FROM table WHERE UNIX_TIMESTAMP(from) IN ($dates) OR UNIX_TIMESTAMP(to) IN ($dates)
Note: array of dates are converted to unix format and implode ",".