skip to Main Content

PHP – get closest date from array – Laravel

I want to get closest date from $search_date if is not same values in $array['date']. If is same value in $array['date'] I want all array. Format date is 'Y-m-d'. Example 1: $search_date = '2022-12-08'; $array = [{"price":"200","date":"2022-12-12"},{"price":"50","date":"2022-12-10"},{"price":"100","date":"2022-12-10"}] Return should be:…

VIEW QUESTION
Back To Top
Search