Home >Backend Development >PHP Tutorial >PHP array key value usage example analysis, PHP array example analysis_PHP tutorial

PHP array key value usage example analysis, PHP array example analysis_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 10:05:56829browse

PHP array key value usage example analysis, PHP array example analysis

The example in this article describes the usage of php array key values. Share it with everyone for your reference. The specific analysis is as follows:

Look at an array first:

<&#63;php
$switching = array(
  10, // key = 0
  5  => 6,
  3  => 7,
  'a' => 4,
  11, // key = 6 (整个数组中整型键索引最大的值是5)
  '8' => 2, // key = 8 (字符串健'8'转换为8)
  '02' => 77, // key = '02'(注意不是2)
  0  => 12 
  /*前面值为10的键被赋予0,而后面重新定义了0键的值为12,
  从而覆盖了前面默认的0键值*/
 );
// empty array
$empty = array();
&#63;>

If printed with print_r($switching), the result is:

Array ( [0] => 12 [5] => 6 [3] => 7 [a] => 4 [6] => 11 [8] => 2 [02] => 77 )

Note that the two-digit number 02 is listed behind.

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/961391.htmlTechArticlePHP array key value usage example analysis, php array example analysis This article describes the php array key value usage example. Share it with everyone for your reference. The specific analysis is as follows: First look at an array:...
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