array analysis

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-08 09:31:411272browse

code

<?php
/**
 * Created by deshengkong.
 * Date: 14/12/23
 * Time: 下午8:07
 */

echo &#39;PHP version:&#39;. 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);

result

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

In array, when values ​​like '12345', '9894321', '9223372036854775807' are used as keys,

when its value is less than Equal to PHP_INT_MAX, press both Numeric processing;

When its value is greater than PHP_INT_MAX, it is processed as string;

The above has introduced array parsing, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:nginx spdy protocolNext article:nginx spdy protocol