This is a deeper immersion in the previous question I had here: Can't access elements in PHP associative arrays numerically (i.e. by index)?
According to W3Schools:
There are three types of arrays in PHP:Numeric Array - An array with a numerical indexAssociative array - an array in which each identification key is associated with a valueMultidimensional array - an array containing one or more arrays
There are three types of arrays in PHP:
But is that for sure? Each element of the array can be assigned either an index or a string as a key - so what happens when two are mixed in the same array?
$myArray[0] = 'value1'; $myArray['one'] = 'value2';
PHP ; -, , .
Manual:
PHP, , .
, , . "" .
Wikipedia:
- , , ( )..... () , . , Python, .
- , , ( ).
...
. () , . , Python, .
PHP, .
PHP . . . .
( "123" . PHP .)
, ArrayObject. , .
, , W3Schools.
, , , .
, W3Schools, .
-
, - . , , ( , . ) , .
- , .
. , , .
. , . . .
, .
, ( ) . .
$arr = array( '1' => 'abc', 2 => 'def' ); var_dump($arr);
array(2) { [1]=> string(3) "abc" [2]=> string(3) "def" }
. :
$myArray[0] = 'value1'; $myArray['one'] = 'value2'; echo($myArray[1]);
? .