Questions tagged as 'array-associativo'

5
answers

Problem with in_array ()

I have a problem with the in_array function. I made a var_dump() in the array I want to search for: array(2) { ["28c8edde3d61a0411511d3b1866f0636"]=> array(8) { ["id"]=> string(32) "c4ca4238a0b923820dcc509a6f75849...
asked by 11.11.2015 / 10:54
1
answer

Type Object in PHP

I'm practicing some code in PHP when I come across this: <?php $a = (object) ["a" => "b"]; $b = (object) ["a" => "c"]; $y = $a <=> $b; echo $y; $v=[1,2,3] <=> [1,2,3]; echo $v; $a= (object) ["a" => "b"]; $b = (object)...
asked by 14.11.2018 / 22:26
2
answers

Go through an array where the index is a Date

How do I go through an Array where the index is a date that varies with each query in the database. Just one detail, the dates are dynamic with each query. Array arrives this way: Array ( [2018-04-07] => Array (...
asked by 29.03.2018 / 19:23
3
answers

Array associative State and City Combobox in Javascript

I'm trying to set up this associative array, in case the combobox is the state of São Paulo, you have to show 5 cities in São Paulo, if it's Rio de Janeiro, it shows the 5 cities of Rio de Janeiro. HTML <select id = "estados"> <...
asked by 15.05.2017 / 20:58
1
answer

How to create, access and manipulate associative arrays?

I'm using GNU-Bash in my MingW terminal (% with%). I need to create a data dictionary to check if a new key was found and associate this new key with an index. For this, I think the best solution would be an associative array. However, I can...
asked by 26.01.2018 / 04:17
2
answers

How to create associative arrays in javascript, json, how to manipulate?

It's the first time I'm dealing with this situation, so I do not know exactly how to get around it. The fact is this, I have a form with several inputs, divided by sections: IntheExperienceTab,IfillinsomeinputswiththedataandwhenIclickaddIcreate...
asked by 15.06.2017 / 06:31
2
answers

How to assign values to an associative array in php?

In an array, for example: $arr = array('item1', 'item2' ... 'itemN'); I want to assign a value to each item. For this, I tried a foreach: foreach($arr as $a => $b) $b = 4; but is informed by the IDE (phpStorm) that the unused lo...
asked by 21.09.2016 / 16:44
1
answer

How to access an item in an array of objects? [closed]

I'm getting information from the database and putting it in an array: (more details of the code) var alunos = {}; var self = 0; function sortearAluno(){ var dataForm = {'tipo': "listar"}; $.ajax({ type:'post', data: d...
asked by 18.09.2016 / 10:14
1
answer

Generating valid Php Array for jSON conversion

Explaining a little bit about the purpose of the code: Through the query sql returns data, the only data needed is the 'id' and the name of the 'area', so two arrays are created, one to receive the 'id's and the other to receive the 'area's', af...
asked by 11.12.2015 / 22:28
2
answers

Display associative array elements with foreach

Hello everyone. I would like to display the elements of an associative array as follows: Nome: José Idade: 32 Profissão: Médico Nome: Rafaela Idade: 28 Profissão: Dentista All this on the same page. And the code I'm using is as follows:...
asked by 05.03.2017 / 07:28