note 123633 deleted from function.is-numeric by crell
| From: | crell@php.net | Date: | Mon, 18 Apr 2022 14:54:51 +0000 |
| Subject: | note 123633 deleted from function.is-numeric by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218274@lists.php.net to get a copy of this message | ||
Note Submitter: sandreas
----
Note that strings with leading zeros containing only digits also return true on check with
is_numeric, although they might be not a valid number. Example:
<?php
$x = 009; // this is invalid php code, 009 is not octal
$y = 007; // this is valid php code, 007 is octal
$z = 01.12; // this also is valid php code
var_dump(is_numeric("009")); // outputs true
var_dump(is_numeric("007")); // outputs true
var_dump(is_numeric("00.12")); // outputs true
?>