PHP DateTime class constructor argument validation
Hi SoloLearners ✋ Upon seeing a question about difference of times https://www.sololearn.com/Discuss/2697030/?ref=app I was inspired to try out PHP's date difference function. But then I realized, that PHP DateTime class' constructor was *probably* buggy, in the fact that it allows its string argument (a date/time expression string) to be an invalid date/time expression e.g. February 30th or 31st. Although it doesn't allow the date part to be greater than 31, but still, I find it to be ridiculously funny. My question, do we have to manually validate a date/time expression to the DateTime class constructor, or is there a better way? also is it a bug, or is it my bad in using the class' constructor? Please anyone, an enlightenment? Thank you in advance 🙏 https://code.sololearn.com/wM7H5z16FVWC/?ref=app