// // "wx30.html" is the raw custom tags delimited by pipes and uploaded by Weather Display // from wxlocal30.html file. // // Ours is at: http://www.carterlake.org/wx30.html // // Just by adding the above bit of PHP code to any PHP aware document, you can then insert // hundreds of custom tags anywhere you want in HTML with: // where X is a number from 0 to n of the custom tags // // So on CarterLake.org, will output "09/26/05", today's date. //------------------------------------------------*/ function get_raw( $rawfile ) { $rawdata = implode('', file($rawfile)); $rawdata = explode('|', $rawdata); return $rawdata; } //------------------------------------------------ // Float is used to strip text off of numbers. // Very useful for taking "76.2°F" and making it "76.2" //------------------------------------------------ function float($str) { if(strstr($str, ",")) { $str = str_replace(".", "", $str); // replace dots (thousand seps) with blancs $str = str_replace(",", ".", $str); // replace ',' with '.' } if(preg_match("#([0-9\.]+)#", $str, $match)) { // search for number that may contain '.' return floatval($match[0]); } else { return floatval($str); // take some last chances with floatval } } ?>