array('val' => '01', 'names' => Array('m', 'M', 'F' ) ), 'day' => array('val' => '01', 'names' => Array('d' ) ), 'year' => array('val' => '2000', 'names' => Array('y', 'Y' ) ), ); function validate($dateVal, $haystack ) { foreach ($this->_date as $key => $type) { foreach ($type['names'] as $name) { if (isset($dateVal[$name])){ $this->_date[$key]['val'] = $dateVal[$name]; } } } switch ($this->name) { case 'date_check': return checkdate($this->_date['month']['val'], $this->_date['day']['val'], $this->_date['year']['val'] ); break; } } // // function getValidationScript($haystack) // { // static $funct_exists; // $haystack = array_map('addslashes', $haystack); // if (!$funct_exists){ // $funct = 'function in_array(needle, haystack) //{ // for (var i = 0; i < haystack.length; i++) { // if (haystack[i] == needle) { // return true; // } // } // return false; //}'; // $funct_exists = true; // $GLOBALS[$key] = true; // } // return array($funct, "!in_array({jsVar}, Array('".implode("', '", $haystack )."'))" ); // } // } ?>