how to get oldest possible date (D Month Yr) from the nested json array in php?

Viewed 23

My code

$response = curl_exec($curl);

$arr = json_decode($response,true);

 foreach($arr['model']['items'] as $test){

  $date = $test['boughtDate'];

   echo "<br>".$date;
   

}

Output:

13 May 2022

27 Feb 2022

30 Nov 2021

12 Dec 2021

07 Jul 2020

01 Feb 2021

22 Jul 2020

I want to get the oldest date and want to store in variable please help me with code.

0 Answers
Related