-
-
Save manniru/15373460d21fc807c158aa4e8ded068b 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