Top "Associative-array" questions

An associative array is an abstract data type composed of a collection of unique keys mapped to a collection of values.

Slicing a multi-dimensional PHP array across one of its elements

Say for example you just queried a database and you recieved this 2D array. $results = array( array('id' => 1, 'name' =&…

php arrays associative-array
How to pass an associative array as argument to a function in Bash?

How do you pass an associative array as an argument to a function? Is this possible in Bash? The code …

arrays bash associative-array associative
PHP: Using spaces in associative array indices

Is this bad practice/can cause problems? $_SESSION['stuff to keep'] As opposed to calling str_replace() on the indices.

php associative-array
Bash associative array sorting by value

I get the following output: Pushkin - 100500 Gogol - 23 Dostoyevsky - 9999 Which is the result of the following script: for …

bash associative-array sorting
java and python equivalent of php's foreach($array as $key => $value)

In php, one can handle a list of state names and their abbreviations with an associative array like this: <?…

java php python associative-array
Value objects vs associative arrays in PHP

(This question uses PHP as context but isn't restricted to PHP only. e.g. Any language with built in hash …

php associative-array value-objects
How to rename an associative array in Bash?

I need to loop over an associative array and drain the contents of it to a temp array (and perform …

bash variables associative-array
Can PHP's list() work with associative arrays?

Example: list($fruit1, $fruit2) = array('apples', 'oranges'); code above of course works ok, but code below: list($fruit1, $fruit2) = array(…

php arrays list associative-array
Interface for associative object array in TypeScript

I have an object like so: var obj = { key1: "apple", key2: true, key3: 123, . . . key{n}: ... } So obj can contain any …

typescript tuples associative-array unions
Selecting a random element from a PHP associative array

I've got an associative array in PHP and want to select a random key/value pair out of it. Here's …

php random associative-array