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.
Feed/

Can PHP array indices be non-contiguous?

No cover

Channel

Computer science one

1 page

"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."

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.