前端PHP入门-021-重点日期函数之日期验证函数

checkdate可以判断一个输出的日期是否有效。

在实际的工作中,我们需要经常用于检测常用于用户提交表单的数据验证。

函数的语法格式如下:

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

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

运行结果:

  1. bool(true)
  2. bool(false)




原文地址:https://www.cnblogs.com/pangxiansheng/p/f4e0f5f5dff36f50bedec58e5b79c861.html