Concept
How does key-value initialization define PHP array keys and values?
ComputerScienceOne / Strings as Indices
"Since associative arrays in PHP can be indexed by either integers or strings and need not be ordered or contiguous, we can use a special key-value initialization syntax to define not only the values, but the keys that map to those values when we initialize an array. The “double arrow,” => is used to denote the mapping.\n\n1 $arr = array(\n\n2 \"foo\" => 5,\n\n3 4 => \"bar\",\n\n4 0 => 3.14,\n\n549"
Related Ideas
- How does key-value initialization define PHP array keys and values?ComputerScienceOne · Key-Value Initialization
- How can key-value pairs be initialized in a PHP array?ComputerScienceOne · Non-Contiguous Indices
- How can strings be used as indices in PHP arrays?ComputerScienceOne · Strings as Indices
- What is key-value initialization?ComputerScienceOne · Strings as Indices . . . . . . . . . . . . . . . . . . . . . . . . . . .
- How can strings be used as indices in PHP arrays?ComputerScienceOne · Non-Contiguous Indices