Questions tagged as 'array-multidimensional'

1
answer

How to rotate an array in Java?

I have a two-dimensional array, size M x N, that stores tiles of a map, in the following format: [1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12] And I want to rotate in 90º (ie rotate the map so that the North is in the East). The rotated...
asked by 08.03.2017 / 05:48
2
answers

Inserting index and value into a two-dimensional array

I have a two-dimensional array (it contains data coming from the database). To traverse this data, I use a foreach (). I need to add an index and a value to this index at the end of each iteration of foreach (). Imagining as if it were an arr...
asked by 19.10.2017 / 18:40
2
answers

Is there a function to reindex a multidimensional array?

Well, I need a help, I have a function that returns the following array: Array ( [0] => Array ( [0] => valor1 [2] => valor2 ) [1] => Array ( [0] => valor3 [1] => valor4 [...
asked by 27.11.2014 / 12:35
2
answers

Print highlighted matrix-specific values

In my studies here with arrays I'm trying to highlight only the odd values (leave bold), but I'm not understanding how to do this. Below is what I did, but it prints both bold and normal numbers. <?php $matriz = array( array(50, 35,...
asked by 13.03.2014 / 14:47
1
answer

remove duplicate values in multidimensional array

I have a huge multidimensional array and I need to remove duplicate values with PHP or some function that does this when using CakePHP. Array structure: Array ( [0] => Array ( [Advertencia] => Array (...
asked by 07.05.2015 / 21:30
1
answer

Keys in PHP Array

I have a good question, I was able to identify the problem, but I could not solve it .. hahahaha It is the following ... I have the following array: array:7 [▼ 1 => array:5 [▶] 2 => array:5 [▶] 4 => array:5 [▶] 10 => arr...
asked by 03.01.2018 / 13:56
1
answer

Create a 2D vector from a 1D vector in Python

I have a vector with the following values: a = [10, 20, 30, 40, 50, 60, 70, 80] I need to create 2D vector with these values. For example, it would have to look like this: b = [[10, 20], [30,40], [50,60], [70,80]] Could someone p...
asked by 11.08.2017 / 18:59
1
answer

Access information in Multidimensional Associative Array (PHP)? [duplicate]

I have the following structure: $arrDados = Array ( [0] => Array ( [NumeroEmpenhoNumero] => Array ( [type] => NULL [size] => 0 [deci] => 0 [code] => 0...
asked by 21.05.2017 / 03:07
2
answers

Jquery problem in handling ajax data coming as array

My array returns from php like this (post): Array ( [0] => Array ( [O email digitado é invalido! Por favor insira um email correto.] => 1 ) [1] => Array ( [O telefone digitado e...
asked by 24.11.2016 / 17:01
1
answer

Add values within the Two-Dimensional Matrix from the line that the user chooses

In the exercise I had to create a 2D array and then when the user types 0, 1 or 2 to know the array line , I should add the values of the line and show the result. I'd like to know if inside the array, if I can add it up without having...
asked by 30.03.2016 / 22:12