how to remove comma from string in php code example
Example 1: trim comma from variable in php
rtrim($my_string,',');
Example 2: 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;
Example 3: remove string after comma in php
preg_replace('/^([^,]*).*$/', '$1', $print);
substr($string, 0, strrpos($string.",", ","));