Created
November 4, 2016 07:31
-
-
Save salipro4ever/c868b1e126f73f554d76b375ca325fcd to your computer and use it in GitHub Desktop.
PHP Helpers
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
| /** | |
| * Convert number string to number | |
| * @param $num string 1,251.11 | |
| * @return numberic | |
| */ | |
| function reverse_number_format(&$num) | |
| { | |
| return $num = (float)str_replace(',', '', trim($num)); | |
| } | |
| -------------- | |
| $number= '$ 1,989.34'; | |
| $number = filter_var($number, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| //1989.34 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment