php date validation function

checkdate can determine whether an output date is valid.

In actual work, we often need to detect data validation commonly used for user submission forms.

For example: Verify whether the time entered by the user is correct.

The syntax format of the function is as follows:

bool checkdate (int $month, int $day, int $year)

In the following example, we You can use a code to conduct experiments and write a real example. Try to see if there is February 29, 2011.

Return true if it is a valid time, return false if it is not a valid time.

<?php
var_dump(checkdate(12, 31, 2018));
var_dump(checkdate(2, 29, 2011));
?>

Output result:

bool(true)
bool(false)


Continuing Learning
||
<?php var_dump(checkdate(12, 31, 2018)); var_dump(checkdate(2, 29, 2011)); ?>
submitReset Code