Bifalgorithm post · Computer science one · Strings as Indices
Can PHP array indices be non-contiguous?
Can PHP array indices be non-contiguous? (Computer science one · Strings as Indices) — "Another aspect of PHP associative arrays is that integer indices need n…
Ideas in this flowchart
- Les indices entiers des tableaux associatifs PHP peuvent être non contigus.
- Les indices peuvent comporter des intervalles manquants.
- Exemple en PHP.
- $arr = array(); initialise un tableau vide.
- $arr[0] = 10; associe la valeur 10 à l’indice 0.
- $arr[5] = 20; associe la valeur 20 à l’indice 5.
- Les valeurs correspondant aux indices 1 à 4 sont indéfinies.
- Le tableau contient donc des « trous » dans ses indices.