<?php
$tests = array(
"42",
1337,
0x539,
'0x539',
02471,
'02471',
(int)'02479',
(int)'02471',
0b10100111001,
'0b10100111001',
1337e0,
'1337e0',
"not numeric",
array(),
9.1
);
foreach ($tests as $element) {
var_export($element);
if (is_numeric($element)) {
echo " is numeric", PHP_EOL;
} else {
echo " is NOT numeric", PHP_EOL;
}
}
preferences:
36.24 ms | 402 KiB | 5 Q