I am trying to filter the line with the price in order to bring it into a readable format. In its original form it may look like this (without quotes): "2,200.00" Help to make a regular schedule to make "2200" I tried this:

$result = preg_replace("/([^0-9,]\s)/iu","", $result); 

Does not work.

    2 answers 2

    If you want to get a float, you can do this:

     $result = (float)strtr($result, array(',' => '.', ' ' => '')); 

    If the whole is enough:

     $result = (int)preg_replace('/[^\d,]/', '', result); 
    • Beat ahead). - ling

    Decided in the following way:

     $result = preg_replace("/[,\s+]/iu","", $result); 

    It seems to work.

    • And get 220000, instead of 2200 - Ilya Pirogov