I have this variable:
$today = date("Y-m-d H:i:s"); // for example today is 2015-10-04 12:30:00
$first_date = "2015-10-01 00:00:00";
$second_date = "2015-10-02 00:00:00";
$third_date = "2015-10-03 00:00:00";
$fourth_date = "2015-10-04 00:00:00";
$fift_date = "2015-10-06 00:00:00";
//place the function - and result to $output $output = "result";
And I need this. If variable of any day is the nearliest to $today from PAST date, set $output = 1; ... If date is in BEFORE $today - ignor thi variable.
For better understanding - I have a DATE in database like this in rows:
So this is a special price from(start) and to(end). In my case, I need to foreach ID_product 4 times and pick up only one row - now it will be row number 3. with ID_special_price = 22, becose this DATE - from(2015-10-04 00:00:00) today (2015-10-04 12:30:00) to(2015-10-05 00:00:00) is the nearest "to" actually date and still active, becose end of this special offer ending 2015-10-05 00:00:00.