/* Treat numbers in string as Fahrenheit values and replace with Celsius values */ $metric = preg_replace('/(-?\d+(?:\.\d+)?)/e', /* pattern */ 'floor(($1-32)*5/9 + 0.5)', /* replacement code */ $string); ----------------------------------------------------------------------------- Copyright 1997-2024 Jeffrey Friedl