PHP: How to get integer or decimal from a string?

http://blog.chapagain.com.np/php-how-to-get-integer-or-decimal-from-a-string/

$string = ‘Nrs 89,994,874.0098’;
echo preg_replace(“/[^0-9\.]/”, ”, $string);
// output: 89994874.0098