PHP: How To Parse Decimal Number from String

PHP How To Parse Decimal Number from String
Home » Blog » PHP: How To Parse Decimal Number from String

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

Tags:

Comments

Leave a Reply

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

Request Free Consultation

"*" indicates required fields

BLOG

Our recent post