1
vote
3answers
38 views

Preferred way of creating “dictionary of dictionaries” in JavaScript

Assume that I need a JavaScript dictionary (object/ associative array) which I need to access as follows: var value = dict[foo][bar][buz][qux]; // this could go on Which is the best way to ...
0
votes
2answers
39 views

Populating an object's properties

Consider following code: $ob=new MyObject(); $ob->name=$_GET['name']; $ob->email=$_GET['email']; ... $ob->foo=$_GET['foo']; Is there any cleaner way (language mechanism) to populating an ...
1
vote
1answer
141 views

Javascript - Count duplicate JSON values and sort Count along with associative key? [duplicate]

Possible Duplicate: Sorting JavaScript Object by property value I want to get the top results for some value within my JSON. Easier explained with the example: var jsonData = { bom: [ ...
0
votes
2answers
250 views

Jquery creating associative array with dynamic keys and multiple values

Trying to create the following: array( '12345' => 'A01', 'A02', 'A03' '22222' => 'B01', '33333' => 'C01', 'C02') So basically each key is different generated dynamically from another ...
3
votes
2answers
160 views

Adding new element to associative array each click

This is probably very easy, but I just can't figure out how to solve it right now. Each time a submit button is clicked, the function below checks input field 1 (name), and if not empty adds the value ...
1
vote
2answers
315 views

Non-destructive JSON encoding/decoding of associative PHP arrays (containing objects)

I am able to JSON encode and decode indexed arrays in a way that the decoded value matches the original input: $array_indexed = ['A']; $encoded = json_encode($array_indexed); $decoded = ...
0
votes
1answer
66 views

Trying to parse through SQL data to make an easier-to-handle associative array

I'm using Wordpress for this, but it is not a Wordpress-centric issue, so I am asking here. You can see a snippet of my code here: http://pastebin.com/Cbc8wKvB <?php function getFormIds() { ...
0
votes
2answers
134 views

changing value in nested dictionary python using class

class warehouse: def __init__(self): self.A={} self.B={} self.racks={'A':self.initialize(self.A),'B':self.initialize(self.B)} def initialize(self,rack): ...
0
votes
1answer
104 views

Putting values from object array into associative array via foreach loop

I have an array of objects, each object contains a bunch of values, two of which are an int and a string. I need to loop over the objects and pull out the string and int and place them into an ...
1
vote
3answers
198 views

php associative array of objects

I'm trying to create associative array of objects from row result set with member id as the key, but getting some error. addATravelog() is just a function of the class UserLogsAndSOS(), whose objects ...
0
votes
3answers
356 views

PHP - associative array as an object [duplicate]

Possible Duplicate: Convert Array to Object PHP I'm creating a simple PHP application and I would like to use YAML files as a data storage. I will get the data as an associative array, with ...
3
votes
3answers
466 views

Checking if an associative array exists in JavaScript

I had the same question as posed here: Checking if an associative array key exists in Javascript . However, I'm looking for a method which will work in all major browsers including IE 6+. The method ...
0
votes
3answers
127 views

How do I get the value of an object by key in javascript?

I'm getting data using var result = $.getJSON. When I console.log(result); I get this object: Object abort: function (a){a=a||"abort",p&&p.abort(a),w(0,a);return this} always: ...
0
votes
1answer
200 views

Two Dimensional Object / Associate Array into Three Dimensional Object Javascript

Is there anyway to go form this var stateDat = { ME: ['Maine',1328361], etc. }; To this var stateDatHistory = { 1:[ ME: ['Maine',1328361], etc. ], 2:[ ME: ['Maine',1328361], etc. ], ...
0
votes
2answers
148 views

PHP - calling array value from method that returns it?

I'm trying to call an array variable directly from a method that returns it. Something like the following: function some_meth() { return array('var1' => 'var); } I know I can do something ...

1 2
15 30 50 per page