Created
          December 7, 2013 22:52 
        
      - 
      
- 
        Save tristar500/7850853 to your computer and use it in GitHub Desktop. 
    Convert string value with commas into a float
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | $val = "1,234,988.56"; | |
| $num = floatval(str_replace(",","",$val)); | |
| echo $num; | |
| // returns - 1234988.56 | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
In case of the format
"1.234.988,56", you can use(float) str_replace(['.', ','], ['', '.'], $value);.