php的数组的key 可以是string类型也可以是integer类型。如果key为一个float类型,会自动的转化为integer类型。
如果没有为一个value指定一个key,integer类型的索引的最大值已经给出的话,新key就是这个最大值加1.如果这个新key已经被赋值,那么这个value将会被覆盖掉。
复制代码 代码如下:
$arr = array('a','b',5=>'c','d','e',6=>'g');
echo '
'; <br>print_r($arr); <br>echo '';
上面代码的结果是
复制代码 代码如下:
Array(
[0] => a
[1] => b
[5] => c
[6] => g
[7] => e)
这个样子。只所以没有value “d” 是因为 他被后面的6=>‘g'这个给覆盖掉了

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools