는 내가 PHP 문서에서이 예제 가로 질러 :PHP Manual : Is_Numeric 예제 1에서의 숫자 변환?
이<?php
$tests = array(
"42",
1337,
0x539,
02471,
0b10100111001,
1337e0,
"not numeric",
array(),
9.1
);
foreach ($tests as $element) {
if (is_numeric($element)) {
echo "'{$element}' is numeric", PHP_EOL;
} else {
echo "'{$element}' is NOT numeric", PHP_EOL;
}
}
?>
출력 :
'42' is numeric
'1337' is numeric
'1337' is numeric
'1337' is numeric
'1337' is numeric
'1337' is numeric
'not numeric' is NOT numeric
'Array' is NOT numeric
'9.1' is numeric
'42'결국 다섯 예는 '1337'에 평가합니다. 이것이 왜 '1337e0'(과학 표기법)의 경우인지 이해할 수 있지만 나머지 이유는 왜 그런지 이해할 수 없습니다.
문서의 주석에 언급 된 사람을 찾을 수 없어서 여기에서 물어 보지 못했습니다. 따라서 '0x539', '02471'및 '0b10100111001'이 모두로 평가되는 이유를 설명 할 수 있습니까? '1337'.