I need the biggest date from current year.
I have an date array as :
$dateArray = array('2019-05-12','2019-04-02','2020-01-07','2019-11-10','2020-07-13','2019-08-15');
As current year is 2019
so I need the value 2019-11-10
as my result.
I need the biggest date from current year.
I have an date array as :
$dateArray = array('2019-05-12','2019-04-02','2020-01-07','2019-11-10','2020-07-13','2019-08-15');
As current year is 2019
so I need the value 2019-11-10
as my result.
First filter the current year by using array_filter
then use max
$dateArray = array_filter($dateArray, function($v){return strpos($v, date('Y')) !== false ? $v : '';});
echo max($dateArray);
Working example : https://3v4l.org/eONDq