This tag is used mostly regarding associative arrays (but better use tag "associative-array" for that) and sometimes in the mathematic sense of tag "associativity", the associative property of binary operations.
Questions tagged [associative]
435 questions
1
vote
1 answer
What in the implementation needs to change in order for a left associative operator to become right associative?
I'm reading up on Haskell and as expected there are some operators that are left associative and others that are right associative. That got me thinking, how would the implementation differ for a new operator ¤, when comparing the left associative…

Patrik Iselind
- 187
- 1
- 11
1
vote
2 answers
How do I remove associative array from javascript?
I found the way to delete an item of associative array by :
delete array['knownkey'];
but what about delete the whole associative array,I mean just like empty an normal array:
the way to empty an normal array is [I found on the google]:
array = []…

qinHaiXiang
- 6,051
- 12
- 47
- 61
1
vote
1 answer
Qt - Associative arrays
Is possible to create an associative array (hash or named arrays) in Qt?
Something like:
int array[2];
array["text1"] = 10;
array["text2"] = 20;

tomsk
- 967
- 2
- 13
- 29
1
vote
1 answer
Searching content of string using PHP associative array notation
I have access to two different servers where I'm running the same code:
On one server, running PHP…

Dentra Andres
- 371
- 1
- 7
- 18
1
vote
1 answer
Clojure extend Assotiative arity
I need to implement custom assoc, but it does not work with multiple arguments. It processes only first pair. It seems that it calls assoc directly, not via core assoc and then RT/assoc.
(def my-assoc (reify
clojure.lang.Associative
…

uNmAnNeR
- 600
- 5
- 12
1
vote
2 answers
create associative array from collection in laravel for checking purposes
I am having an hard time trying to create an associative array from a collection in Laravel. The array should then be used for case checking.
I get my collection like this:
$collected_items = $user->collected_items()->where('model_id', '=',…

Chriz74
- 1,410
- 3
- 23
- 47
1
vote
2 answers
PHP add array to another array auto $key with foreach
I'm trying to manage adding one array in another array but that doesn't work. Sorry if the question was already asked (but I can't find it in stackoverflow).
Here is what I'm trying to do :
$this->dataSector[0] = array('Secteur' => "S1",
…

Peacefull
- 546
- 6
- 24
1
vote
1 answer
How to access nested associative array data in PHP
I have an indexed array that contains a nested associative array AND a nested indexed array:
$myArray = array (
0 => array (
'name' => 'Paul',
'age' => '23',
'hobbies' => array (
0 => 'basketball',
…

user3452136
- 125
- 1
- 1
- 11
1
vote
2 answers
Javascript associative array how to map multiple strings to a number
Javascript newbie here. I currently have an associative array in the following format:
StringA: number,
StringB: number
Is it possible to map multiple strings to the same number? Something like this (some numbers may have a different number of…

Nishant
- 131
- 2
- 12
1
vote
1 answer
Change two arrays into one associative array
I have this 2 following functions, to fill an array with value. I want to fill only 1 array instead of 2. How can I make an associative array ?
var itemMetaArray = [];
var itemLabelArray = [];
$('.frm_pro_form input, .frm_pro_form select,…

Nathan30
- 689
- 2
- 8
- 29
1
vote
2 answers
Creating nested associative arrays in Oracle 11g
I have defined associative array in Oracle as below
CREATE OR REPLACE TYPE outlier AS OBJECT (
ACCOUNT_ID varchar2(100),
INC_MONTH date,
);
create or replace type outlier_acc_tab as table of outlier ;
CREATE OR REPLACE TYPE…

Maa
- 75
- 6
1
vote
2 answers
How to echo values of an associative array returned by function
I'm trying to accomplish something using an associative array as suggested somewhere else here on Stackoverflow, but I've never used arrays so I'm struggling. I've looked it up but only to be left more confused than I was!
Here's the deal: I want…

Bankitalia
- 21
- 4
1
vote
1 answer
How to sum values of same key in array associative
I'm not getting this right when trying to sum values of keys that are same within an associative array. I thought it's gonna be easy task, but it ain't the case so please...
I'm expecting following result:
1 -->(7)
2 -->(14)
Here's the array:
…

alexis
- 43
- 7
1
vote
1 answer
Only keep elements with a certain name pattern in an associative php array and remove the remaining elements from the array
I have an associative Php array, which looks like this on print_r
Array ( [dyna[0]] => one [add[0]] => ⇊ [rem[0]] => Delete Column [dyna[1]] => two [add[1]] => ⇊ [rem[1]] => Delete Column [dyna[2]] => three [add[2]] => ⇊ [rem[2]] =>…

Sebastian
- 89
- 2
- 12
1
vote
2 answers
how to access row in associative array?
This table consist of 3 column : key-name of product, total value, and rank. These ranks is sorted arsort based on the total value. How to echo only the name of product in the first row that has the biggest total value? How to access the key of the…

rafdwna
- 19
- 3