Blogger Information
Blog 7
fans 0
comment 2
visits 17158
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php数组题目
gu陈
Original
1919 people have browsed it
$arr = [
  2 => 'a',
  5 => 'b',
  6 => 'c',
  7 => 'e',
  8 => 'f'
];
echo $arr[6];    //    c
echo $arr[7];    //    d


还原真面目(php数组如果未指定键名(key),将自动使用之前用过的最大integer键名加上1作为新的键名,如果当前还没有整数索引,则键名将为 0)

Array
(
    [2] => a
    [5] => b
    [6] => c
    [7] => d
    [7] => e
    [8] => f
)

但是因为键名不能重复,后面的将覆盖掉前面的,所以结果如下:

Array
(
    [2] => a
    [5] => b
    [6] => c
    [7] => e
    [8] => f
)


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post