PHP – Why date_diff returns unexpected result?
I want to get the number of days between the two dates. // DD-MM-YYYY $date[0] = "01-03-2023"; $date[1] = "30-03-2023"; echo date_diff(date_create($date[0]),date_create($date[1]))->d + 1; The program above returns 2, instead of the right number of days. >Solution : You should call date_diff()->days which returns the number of days between the 2 dates. Please change: echo… Read More PHP – Why date_diff returns unexpected result?