code: public static function isBirthNumber($no)
      {
          if (!preg_match('#^\s*(\d\d)(\d\d)(\d\d)[ /]*(\d\d\d)(\d?)\s*$#', $no, $matches)) {
              return false;
          }
  
          list(, $year, $month, $day, $ext, $c) = $matches;
  
          if ($c === '') {
              $year += $year < 54 ? 1900 : 1800;
          } else {
              $mod = ($year . $month . $day . $ext) % 11;
              if ($mod === 10) {
                  $mod = 0;
              }
              if ($mod !== (int)$c) {
                  return false;
              }
              $year += $year < 54 ? 2000 : 1900;
          }
          if ($year > 2003) {
              if ($month > 70) {
                  $month -= 70;
              }
              if ($month > 20 && $month < 50) {
                  $month -= 20;
              }
          }
          if ($month > 50) {
              $month -= 50;
          }
  
          return checkdate($month, $day, $year);
      }
docs: Check if the birth number is valid
  
  @param string $no Birth number
  @return bool Is valid