Answers for "make number float php"

PHP
1

string to float php

$floatValue = floatval("1.0");
Posted by: Guest on May-13-2020
0

number format to float php

$num = '1,200,998.255';

########## FOR FLOAT VALUES ###########################

echo filter_var($num, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);

#output  : 1200998.255

########## FOR INTEGER VALUES ###########################

echo filter_var($num, FILTER_SANITIZE_NUMBER_INT);

#output  : 1200998
Posted by: Guest on November-20-2020

Browse Popular Code Answers by Language