We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seems that strings with trailing Zero do not validate correctly
Inspekt::isFloat("1.60") === false floatval() trims the trailing Zero strval(1.6) !== "1.60"
Inspekt::isFloat("1.60") === false
The text was updated successfully, but these errors were encountered:
Should fix it ` /** * Returns true if value is a valid float value, false otherwise. * * @param string $value * @return boolean * * @Assert(10244578109.234451) === true * @Assert('1.60') === true * @Assert('1.00') === true * @Assert('10244578109.234451') === false * @Assert('10,244,578,109.234451') === false * * @tag validator */ public static function isFloat($value) { $locale = localeconv(); $value = str_replace($locale['decimal_point'], '.', $value); $value = str_replace($locale['thousands_sep'], '', $value); $value = rtrim($value,'0'); $value = rtrim($value,'.');
return (strval(floatval($value)) === $value); }`
Sorry, something went wrong.
No branches or pull requests
Seems that strings with trailing Zero do not validate correctly
Inspekt::isFloat("1.60") === false
floatval() trims the trailing Zero
strval(1.6) !== "1.60"
The text was updated successfully, but these errors were encountered: