Contact: aviboots(AT)netvision.net.il
40,866 questions
53,271 answers
573 users
$text = "The price is 148.95 dollars"; $floatRegex = '/[-+]?\d*\.\d+|\d+/'; if (preg_match($floatRegex, $text, $matches)) { $number = floatval($matches[0]); echo "Extracted float: " . $number; } /* run: Extracted float: 148.95 */