Are numeric and associative arrays in PHP two different things?

后端 未结 4 1794
庸人自扰
庸人自扰 2020-12-19 12:03

This is a deeper dive into a previous question I had here: Can items in PHP associative arrays not be accessed numerically (i.e. by index)?

According to W3Schools, :

4条回答
  •  再見小時候
    2020-12-19 12:12

    You get an associative array. Try this code:

    $myArray[0] = 'value1';
    $myArray['one'] = 'value2';
    
    echo($myArray[1]);
    

    See? It doesn't echo anything.

提交回复
热议问题