PHP - Filter Non Numerals from a string -
i have variable: $number that contain values in these formats: 125.00 125.00 $125.00 i need insert number database, need remove/filter out isn't number whilst retaining decimals points. not sure how/best approach in php? use regex : <?php $num = "125.00"; $num = preg_replace("/([^0-9\.,])/","",$num); $num = (double) $num; // make double allow point , comma $num = (int) $num; // , convert integer echo $num; ?>