Answers for "php remove decimal and comma from string"

PHP
0

remove comma in numeric in php

$var = 18,542.00;
$var = intval(preg_replace('/[^\d.]/', '', $var));
result :- 18542;
or if you need float
$var = floatval(preg_replace('/[^\d.]/', '', $var));
result :- 18542.00;
Posted by: Guest on April-09-2021
0

remove number after decimal in php

(int)-1.2
Posted by: Guest on November-06-2020

Code answers related to "php remove decimal and comma from string"

Browse Popular Code Answers by Language