Concept
Can PHP array indices be non-contiguous?
ComputerScienceOne / Strings as Indices
"Another aspect of PHP associative arrays is that integer indices need not be contiguous. For example,\n\n1 $arr = array();\n\n2 $arr[0] = 10;\n\n3 $arr[5] = 20;\n\nThe values at indices 1 through 4 are undefined and the array contains some “holes” in its indices."
Related Ideas
- How can you iterate over indexed and associative arrays in PHP?ComputerScienceOne · Iteration
- How can key-value pairs be initialized in a PHP array?ComputerScienceOne · Non-Contiguous Indices
- How does unset() remove elements from a PHP array?ComputerScienceOne · Removing Elements
- How can strings be used as indices in PHP arrays?ComputerScienceOne · Non-Contiguous Indices
- How are elements added to the next available integer index in a PHP array?ComputerScienceOne · Removing Elements
- How do you create and index arrays in PHP?ComputerScienceOne · Creating Arrays
- How can you extract array keys and values and compare arrays in PHP?ComputerScienceOne · Iteration
- How does PHP search arrays?ComputerScienceOne · Sorting