Answers for "php remove string after comma"

PHP
1

trim comma from variable in php

rtrim($my_string,',');
Posted by: Guest on October-22-2020
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 string after comma in php

preg_replace('/^([^,]*).*$/', '$1', $print);
substr($string, 0, strrpos($string.",", ","));
Posted by: Guest on March-18-2021
0

remove behind comma php

$print=preg_replace('/^([^,]*).*$/', '$1', $print);
Posted by: Guest on March-30-2020

Code answers related to "php remove string after comma"

Browse Popular Code Answers by Language