コード例 #1
0
 if ($poss !== false) {
     $html = substr($pagetext, $poss + strlen($html), 4);
     if ((int) $html == (int) $jahr + 1) {
         $jahr = $html;
         $next_year = true;
     }
 }
 $days_in_year = 365;
 $poss = 0;
 $marray = array('1' => 31, '2' => 28, '3' => 31, '4' => 30, '5' => 31, '6' => 30, '7' => 31, '8' => 31, '9' => 30, '10' => 31, '11' => 30, '12' => 31);
 if (is_leapyear($jahr)) {
     $marray['2'] = 29;
     $days_in_year++;
 } else {
     if ($next_year) {
         if (is_leapyear($jahr - 1)) {
             $days_in_year++;
         }
     }
 }
 $not_next_year = !$next_year;
 $count = 0;
 $max_count = 100;
 $html = EMPTY_STRING;
 $haystack_start = 0;
 while (true) {
     $poss = strpos($pagetext_small, $monat_text, $poss);
     if ($poss === false) {
         break;
     } else {
         $poss += $monat_len;
コード例 #2
0
function birthday_validation($month, $day, $year)
{
    switch ($month) {
        case '01':
        case '03':
        case '05':
        case '07':
        case '08':
        case '10':
        case '12':
            if ($day > 31) {
                $errors[] = "Invalid birthday";
            }
            break;
        case '04':
        case '06':
        case '09':
        case '11':
            if ($day > 30) {
                $errors[] = "Invalid birthday";
            }
            break;
        case '02':
            if (is_leapyear($year)) {
                if ($day > 29) {
                    $errors[] = "Invalid birthday";
                }
            } else {
                if (!is_leapyear($year)) {
                    if ($day > 28) {
                        $errors[] = "Invalid birthday";
                    }
                }
            }
            break;
    }
    return $errors;
}