Tagged Questions
0
votes
2answers
19 views
Recursive way to find parent_id and convert a multidimensional array to one dimensional
I want to convert a multidimensional array, like:
array (size=3)
0 =>
object(stdClass)[853]
public 'id' => int 1
public 'children' =>
array (size=5)
0 ...
1
vote
2answers
43 views
Recursively chain specific values together without passing an array by reference
Imagine the following multi-dimensional array:
$a = array(
'key' => 'hello',
'children' => array(
array(
'key' => 'sub-1'
),
array(
'key' => 'sub-2',
...
0
votes
1answer
77 views
projections and index on 2D nested arrays in mongodb
> db.foo.save({'foo': [{f0: 'a', f1: 'b'}, {f0: 'c', f1: 'd'}]})
> db.foo.save({'foo': [{f0: 'a', f1: 'e'}, {f0: 'f', f1: 'g'}]})
> db.foo.save({'foo': [['a', 'b'], ['c', 'd']]})
> ...
0
votes
2answers
56 views
Generate nested array codeigniter
For a graph I'm working on, I'm trying to generate a nested array. I'm querying the database to try and get all the data from a certain column in my database as an array, but i'm not really quite sure ...
1
vote
0answers
101 views
Assign_block_vars in multi-dimensional arrays
I have a unique problem that I cannot seem to find or figure out the answer to because I am trying to do a few things at once. I've tried researching each thing to find out the answer but it is ...
3
votes
2answers
108 views
Return matching nested array in Ruby
I have a nested "main" array and I am looking to return the results (the entire nested array) for elements matched in a second "match" array. I have been able to return the first value of the arrays ...
0
votes
2answers
276 views
Sort three level nested array in descending order with php
How to sort following array in descending order by sorder? The whole array is considered to be one array for descending sorting.I see some other questions like this but none of them helped me.
...
0
votes
2answers
54 views
Get PHP array value [duplicate]
I have an array like the following:
Array
(
[0] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
[1] => Array
(
...
-1
votes
2answers
200 views
Covert flat array to Nested Array in PHP
Given the following input:
array('one/two/3',
'one/four/0/5',
'one/four/1/6',
'one/four/2/7',
'eight/nine/ten/11')
How can I convert it into this:
array(
'one': array(
...
0
votes
1answer
171 views
Building multi-dimensional array from rowset [duplicate]
Possible Duplicate:
How to create multi-dimensional array from a list?
PHP Create a Multidimensional Array from an array with relational data
I currently have a parent-child model in my ...
2
votes
2answers
2k views
MongoDB: How to query nested arrays?
I’m trying to build a simple blog system in PHP with MongoDB just to give Mongo a try but I’ve ran into some difficulties querying it.
I’ve generated 2000 random posts where each blogpost document ...
2
votes
1answer
518 views
Reorder Ruby array based on the first element of each nested array
My goal is to convert a into b:
a = [["a","b"], ["d", "c"], ["a", "o"], ["d", "g"], ["c", "a"]]
b = [[["a","b"], ["a", "o"]], ["c", "a"], [["d", "c"], ["d", "g"]]
They are grouped by the first ...
0
votes
1answer
137 views
Javascript Nested-Array throwing 'TypeError' - Error
I'm trying to create a nested array in Javascript, but whatever I try to get something out of this array I get an error 'TypeError'. Here is the code snippet:
var domains =new Array();
...
0
votes
2answers
500 views
Compare multi dimentional arrays in javascript
I would like to compare 2 "multidimensional" arrays (arrays nested in arrays).
var old_dataArray=new Array(("id-2", "message", "user"), ("id-1", "message", "user"), ("id-0", "message", "user"));
var ...
1
vote
1answer
2k views
How to create nested php arrays recursively?
I have some data in this format:
one,one
two,two
sub_one,one
sub_two,two
sub_sub_one,sub_one
sub_sub_two,sub_two
sub_sub_sub_one,sub_sub_one
sub_sub_sub_two,sub_sub_two
Now I want to create nested ...