<?php
$strings = [
' 1 ',
'+1',
'1e9',
];
foreach ($strings as $string) {
echo "'", $string, "': ", is_numeric($string) ? 'yes' : 'no', "\n";
$string = str_repeat($string, 2);
echo "'", $string, "': ", is_numeric($string) ? 'yes' : 'no', "\n\n";
}
- Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- ' 1 ': yes
' 1 1 ': no
'+1': yes
'+1+1': no
'1e9': yes
'1e91e9': no
preferences:
53.16 ms | 402 KiB | 62 Q