Q:

Write a PHP script to remove nonnumeric characters except comma and dot

0

Write a PHP script to remove nonnumeric characters except comma and dot.

Sample string : '$123,34.00A'

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
$str1 = "$12,334.00A";
echo preg_replace("/[^0-9,.]/", "", $str1)."\n";
?>

Sample Output:

12,334.00

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now