How can I find the maximum and minimum date in an array?

后端 未结 4 2071
情深已故
情深已故 2021-01-05 08:45

I need to find the maximum and minimum date from a given array using PHP.

I have $date_arr which contains following values,

  $date_arr = array(\'0\'         


        
4条回答
  •  逝去的感伤
    2021-01-05 08:45

    max() and min() works fine with your array:

    echo "Latest Date: ". max($dates)."\n";
    echo "Earliest Date: ". min($dates)."\n";
    

提交回复
热议问题