Questions tagged as 'array-associativo'

1
answer

Create array and count values

I'm having a hard time drawing a array in PHP with the following data coming from a JSON object, no, it does not come from a SQL query in a database. Example of JSON : [ { "data": { "ID": "349", "use...
asked by 26.03.2018 / 15:54
1
answer

Correlate vectors through the index and assign different values

I have the following vectors: posicao_1 = [4, 62, 24, 18, 47, 62, 63, 78, 68, 87, 24, 18, 6, 8, 12, 17] posicao_2 = [43, 61, 21, 19, 46, 63, 68, 72, 66, 89, 29, 10, 8, 7, 6, 15] I need to look at the vector POSITION_1 the value [24, 18]....
asked by 12.08.2017 / 01:17
1
answer

Array_push in multidimensional associative arrays in php

I started an array ($ arrDados = array ();) and now I need to add information (array_push) so that I can access the information later as follows: colA1 = $arrDados['NumeroEmpenhoAno']['code']; colA2 = $arrDados['NumeroEmpenhoAno']['size']; co...
asked by 21.05.2017 / 03:48
1
answer

How to replace the contents of an array?

I have a div (mosaic of users) that inside it has a array (javascript) with photos of users (data coming from the bank). The number of user photos must be less than or equal to 15. If array has less than 15 users (photos), i...
asked by 01.11.2016 / 14:31
0
answers

Unify Multidimensional Array in only 1 array in PHP

Is it possible to transform a Multidimensional array into just 1 (one) array in php? What would be the process for doing this? In the image below, I need to transform the array on the left side so that the records are the same as the one on t...
asked by 18.06.2018 / 16:13
1
answer

Get the position of an associative Array inside another Array

I have this array's associative array: Array { [0]=> array(4) { ["nome"]=> string(35) "ACRILEX TECIDO 37ML AMARELO CANARIO" ["preco"]=> string(4) "1.65" ["quantidade"]=> string(1) "...
asked by 29.09.2017 / 10:34
1
answer

How to get only one element from an associative array

I'm pulling from the Cosmos API the data of a product, it returns me a json that I converted to an array string using $array = json_decode($data); When I run var_dump($array) it returns me this: object(stdClass)#34 (15) { ["d...
asked by 08.06.2017 / 20:02
1
answer

Infinite Scroll with PHP array

I have a PHP array with about 10,000 keys organized like this: Array ( [0] => Array ( [id] => 13154 [photo_file] => 013154.jpg ) [1] => Array ( [id] => 7885...
asked by 21.04.2017 / 19:48
1
answer

Foreach and multidimensional associative array with only one item

All good personal, I'm facing a problem with foreach in PHP, where I get an xml and convert it to array. In some cases xml has only one item (see example below) <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> <bloco...
asked by 29.11.2016 / 15:57
0
answers

Create associative array to store data structure

My question is based on: "I have a small piece of code where the user types how many colleges there are in the area, how many rooms there are, how many subjects and how many students. and according to the number of students a name is included fo...
asked by 11.11.2014 / 12:28