Maison >développement back-end >tutoriel php >array解析
code
<?php /** * Created by deshengkong. * Date: 14/12/23 * Time: 下午8:07 */ echo 'PHP version:'. phpversion() . PHP_EOL; $arr2 = array( 1 => 'giraffe', '2' => 'panda', 9223372036854775806 => 'bird', '9223372036854775807' => 'deer', '9223372036854775808' => 'pig' ); echo 'PHP_INT_MAX:' . PHP_INT_MAX . PHP_EOL; var_dump($arr2);
PHP version:5.6.2 PHP_INT_MAX:9223372036854775807 array(5) { [1] => string(7) "giraffe" [2] => string(5) "panda" [9223372036854775806] => string(4) "bird" [9223372036854775807] => string(4) "deer" '9223372036854775808' => string(3) "pig" }conclusion
在array中,类似 '12345'、'9894321'、'9223372036854775807'这种值作为key时,
当其值小于 等于PHP_INT_MAX,都按numeric处理;
当其值大于PHP_INT_MAX,都按string处理;
以上就介绍了array解析,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。