Do arrays in PHP only obtain values ​​based on the keys in the array? Are subscripts useless to PHP?
zl
zl 2019-07-13 15:37:25
0
2
1161

 $arrayName3=array("name"=>"张三","age"=>18,"gnner"=>"男",0=>12);

echo $arrayName3[1];

Notice: Undefined offset: 1 in /data/lab/3fkt36wm/index.php on line 15

zl
zl

reply all(1)
angryTom

Your array is an associative array, not an index array. Therefore, you cannot use subscripts to access elements in the array, you can only access them through the key names you set

  • reply emmm, I understand. Thanks
    zl author 2019-07-15 10:16:10
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template