PHP: How To Parse Decimal Number from String

PHP How To Parse Decimal Number from String


$string = "$4.9/inch";
$res = filter_var($string, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
echo $res;

It will print
4.9

Let’s create something beautiful and innovative together! call us now!

Chat with our seniors to see if we have a good match

SHARE IT ON

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

BLOG

Our recent post