"string", "Year"=>"int", "Seed"=>"float", "School"=>"string", "Finals"=>"float", "Comp#"=>"int", "H#"=>"int", "Points"=>"int", "SL"=>"int", "Prelims"=>"float", "Time"=>"float", "ROUND"=>"string"); public static $keys_fld_Place = array("SL"); public static $keys_fld_perform_time_char = array("Time","Prelim","Prelims","Final","Finals"); public static $keys_fld_school_name = array("School"); public static $keys_fld_athlete_name = array("Name"); public static $keys_fld_class_year = array("Year"); static function startsWithOneOfThem($haystack, $needles) { foreach($needles as $k=>$needle) { if(self::startsWith($haystack, $needle)) { return true; } } return false; } static function startsWith ($haystack, $needle) { $len = strlen($needle); return (substr(strtolower($haystack), 0, $len) === strtolower($needle)); } static function endsWithOneOfThem($haystack, $needles) { foreach($needles as $k=>$needle) { if(self::endsWith($haystack, $needle)) { return true; } } return false; } static function endsWith($haystack, $needle) { $len = strlen($needle); if ($len == 0) { return true; } return (substr(strtolower($haystack), -$len) === strtolower($needle)); } static function containsWhichOneOfThem($haystack, $needles) { foreach($needles as $k=>$needle) { if(self::contains($haystack, $needle)) { return $needle; } } return false; } static function containsOneOfThem($haystack, $needles) { foreach($needles as $k=>$needle) { if(self::contains($haystack, $needle)) { return true; } } return false; } static function contains($haystack, $needle) { foreach($haystack as $k=>$hay) { if(strtolower($hay)===strtolower($needle)) { return true; } } return false; } static function getWords($sentence,$trim=true) { $words = array(); $ws = explode(" ", $sentence); foreach($ws as $wds) { if($trim && trim($wds)=='') { continue; } $words[] = trim($wds); } return $words; } static function in_array_i($haystack, $needle) { return in_array(strtolower($needle), array_map("strtolower", $haystack)); } static function array_key_exists_i($haystack, $needle) { foreach(array_keys($haystack) as $key) { if(strtolower($key)===strtolower($needle)) { return true; } } return false; } static function get_start_end_pos($haystack, $needle) { $lastPos = 0; $positions = array(); $return = array(); while (($lastPos = strpos($haystack, $needle, $lastPos))!== false) { $positions[] = $lastPos; $lastPos = $lastPos + strlen($needle); } $ind=0; foreach ($positions as $value) { $return[$ind]['START-POSITION'] = $value; $return[$ind]['END-POSITION'] = ($return[$ind]['START-POSITION'] + strlen($needle))-1; $return[$ind]['LENGTH'] = strlen($needle); $ind++; } return $return; } static function get_array_value_i($array, $key) { foreach($array as $k=>$val) { if(strtolower(trim($k))===strtolower(trim($key))) { return $val; } } return ''; } static function parse_host($url) { return parse_url($url,PHP_URL_HOST); } static function removeAlphabetsOnly($string) { return preg_replace("/[^0-9.:\-]/", "", $string); } static function numerizeTime($string) { $calcData = $string; $expld = explode(":",$string); if(sizeof($expld)==3) { $calcData = (floatval($expld[0])*60*60)+(floatval($expld[1])*60*60)+floatval($expld[2]); } else if(sizeof($expld)==2) { $calcData = (floatval($expld[0])*60)+floatval($expld[1]); } else { $calcData = floatval($expld[0]); } return $calcData; } static function numerizeLength($string) { $calcData = $string; $expld = explode("-",$string); if(sizeof($expld)==2) { $calcData = (floatval($expld[0])*12)+floatval($expld[1]); } else { $calcData = floatval($expld[0]); } return $calcData; } } ?>