For example I have array:
Array(
[0] => 15
[1] => 6
[2] => 19
[3] => 21
[4] => 18
)
If current time is 20 then I need value 19 (which is less than and near to 20)
similarly if I pass my X number as 17 it will return 15 from array.
If 7 then it should return 6.
Please suggest how to achieve that with PHP?
Thanks!