multidimensional-array Questions

3

How to make an element array inside an array explode again. I have an array like this echo "<pre>"; print_r($pks); The Result. Array ( [0] => 2017-04-15||KMTC_HOCHIMINH [1] => 201...
Helve asked 19/5, 2017 at 2:41

9

I wonder, can binary search be applied on a 2D array? What would the conditions on the array be? Sorted on 2D?? What would be the time complexity for it? How would the algorithm change the bounda...
Tadashi asked 12/12, 2010 at 11:55

10

I have several method to transform php array to csv string both from stackoverflow and google. But I am in trouble that if I want to store mobile number such as 01727499452, it saves as without fir...
Percolate asked 3/5, 2013 at 6:0

6

Solved

Here is what I am using: class something { char flags[26][80]; } a; std::fill(&a.flags[0][0], &a.flags[0][0] + 26 * 80, 0); (Update: I should have made it clear earlier that I am using t...
Tourane asked 16/10, 2010 at 9:14

7

Solved

Basically, I have a multidimensional array, and I need to check whether or not it is simply empty, or not. I currently have an if statement trying to do this with: if(!empty($csv_array)) { //M...
Rici asked 23/8, 2013 at 11:22

4

Solved

I am little new to javascript and I am having alittle trouble wrapping my head around making a 2d (or maybe i might need a 3d) array in javascript. I currently have 2 pieces of information i need ...
Valkyrie asked 3/3, 2012 at 4:42

8

Solved

I have created a multidimensional array in JavaScript and I want to find the exact index of specific value. That value will be user input. var array = []; var k = 0; for (var i = 0; i < 10; i++)...
Cowardly asked 19/4, 2013 at 10:12

6

Solved

I am using the following foreach loop to populate a new array with filtered data. foreach ($aMbs as $aMemb) { $ignoreArray = array(1, 3); if (!in_array($aMemb['ID'], $ignoreArray)) { $aMembersh...
Gooey asked 30/9, 2010 at 18:57

4

[ 1 => ['id' => 1, 'sort' => 1], 3 => ['id' => 3, 'sort' => 3], 2 => ['id' => 2, 'sort' => 2], ] How do I sort it so that it's re-ordered using the inner 'sort' key? ...
Unripe asked 27/9, 2010 at 13:34

10

Solved

I am sure that this is super easy and built-in function in PHP, but I have yet not seen it. Here's what I am doing for the moment: foreach($array as $key => $value) { echo $key; // Would outp...
Incredulous asked 23/7, 2010 at 11:54

2

Solved

I have a 3D numpy array of shape (t, n1, n2): x = np.random.rand(10, 2, 4) I need to calculate another 3D array y which is of shape (t, n1, n1) such that: y[0] = np.cov(x[0,:,:]) ...and so o...

2

Solved

Example input as json { "user":{ "name":"Thomas", "age":101 }, "shoppingcart":{ "products":{ "p1":"someprod", ...
Sturdivant asked 13/4, 2018 at 11:50

5

Solved

I have a multidimensional array that I am searching trough for specific values. If those values are found I need to extract the indexes with those values ( make new array ) and remove all others. ...
Lynlyncean asked 18/4, 2014 at 16:44

7

Solved

I'm playing with Typescript and I wonder, how to properly instantiate and declare multidimensional array. Here's my code: class Something { private things: Thing[][]; constructor() { things = ...
Limburger asked 9/5, 2015 at 20:18

2

I have a nested array tree, generated from a flat array with the following function: function convertToTree( array $flat, $idField = 'id', $parentIdField = 'parentId', $childNodesField = 'child...
Cristionna asked 25/6, 2013 at 9:11

33

Solved

I have a list of lists like [ [1, 2, 3], [4, 5, 6], [7], [8, 9] ] How can I flatten it to get [1, 2, 3, 4, 5, 6, 7, 8, 9]? If your list of lists comes from a nested list comprehension, the pr...
Rattlesnake asked 4/6, 2009 at 20:30

4

Solved

I've got a multidimensional array of which I can't know the depth. The array could for example look like this: $array = array( 1 => array( 5 => array( 3 => 'testvalue1' ) ), 2 =>...
Progenitor asked 21/10, 2011 at 20:29

13

Solved

What are the differences between multidimensional arrays double[,] and array of arrays double[][] in C#? If there is a difference? What is the best use for each one?
Dickdicken asked 28/2, 2009 at 7:55

14

Solved

Is there a way to convert a multidimensional array to a stdClass object in PHP? Casting as (object) doesn't seem to work recursively. json_decode(json_encode($array)) produces the result I'm looki...
Bax asked 25/1, 2011 at 5:55

6

Solved

I want to do something like: object[] rowOfObjects = GetRow();//filled somewhere else object[,] tableOfObjects = new object[10,10]; tableOfObjects[0] = rowOfObjects; is this somehow possible an...
Cracknel asked 8/7, 2009 at 16:47

4

Solved

I would like to copy a specific row from a multidimensional array to a new one dimensional array that can be used somewhere else in my code. Input: Multidimensional array[3,3]: 33 300 500, 56 35...
Jury asked 25/1, 2016 at 6:18

10

Solved

int matrix[9][9],*p; p=matrix[0]; this works and gives first row of matrix, but how to get first column of matrix I've tried p=matrix[][0]; ? Also I don't understand why below code gets compiler...

2

Solved

In plpgsql, I want to get the array contents one by one from a two dimension array. DECLARE m varchar[]; arr varchar[][] := array[['key1','val1'],['key2','val2']]; BEGIN for m in select arr LOOP...
Beelzebub asked 20/3, 2012 at 8:21

2

Solved

I have a 2d array and want to select only the 1st 1d array from it. How do I do that?
Quince asked 23/9, 2014 at 13:21

7

Solved

I have a multi-dimentional array set up as follows array() { ["type1"] => array() { ["ticket1"] => array(9) { // ticket details here } ["ticket2"] => array(10) { // ticket det...
Investigator asked 30/1, 2012 at 10:56

© 2022 - 2025 — McMap. All rights reserved.