The following code successfully validates the string “0123.250” as a valid float, when it is not. Is this a PHP bug or did I do something wrong?
filter_var('0123.250', FILTER_VALIDATE_FLOAT);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the PHP documentation on float literals:
As you can see, there is no restriction for leading zeroes, as indicated by these bits:
[0-9]*[\.]and[0-9]+.Since the page never once mentions octal, we need to assume that leading zeroes make no difference in the interpretation.
I assume that the exact same rules are applied for
FILTER_VALIDATE_FLOAT.