function ph_HappyMonday($y, $m, $d) { $tbl = tbl_HappyMonday(); if (!is_array($tbl)) { $ret['name'] = ''; $ret['rc'] = 0; return $ret; } $ret = array(); $w = zeller($y, $m, $d); // Calculation of a day of the week $n = (int) (($d - 1) / 7) + 1; // Is it equivalent to the n-th time? foreach ($tbl as $x) { if ($x[0] == $m) { // In the case of the applicable Month. if (chk_from_to($y, $m, $d, $x[3], $x[4])) { // In the case of within an object period. if ($w == $x[2]) { if ($n == $x[1]) { $ret['name'] = $x[5]; $ret['rc'] = 1; return $ret; } elseif ($x[1] == 9) { if (is_LastDayOfWeek($y, $m, $d)) { $ret['name'] = $x[5]; $ret['rc'] = 1; return $ret; } } } } } elseif ($x[0] > $m) { break; } } $ret['name'] = ''; $ret['rc'] = 0; return $ret; }
function ph_HappyMonday() { foreach ($this->tbl_HappyMonday as $x) { if ($x[0] > $this->m) { return; } if ($x[0] != $this->m) { continue; } if (!$this->chk_from_to($x[3], $x[4])) { continue; } // In the case of within an object period. if ($this->w != $x[2]) { continue; } if ($this->n == $x[1]) { $this->rc['rc'] = 1; $this->rc['name'] = $x[5]; return; } elseif ($x[1] == 9) { if (is_LastDayOfWeek($this->y, $this->m, $this->d)) { $this->rc['rc'] = 1; $this->rc['name'] = $x[5]; return; } } } }