Questions tagged as 'array'

1
answer

Two foreachs php - Duplicate data

I have two selects that return two arrays and I need to go through them in the same table, but the records are being duplicated. How can I best resolve this issue? Follow the example: <?php foreach ($contratante...
asked by 26.11.2016 / 03:18
1
answer

What is java.util.ConcurrentModificationException? [duplicate]

What causes this exception? How can we prevent this exception? How to fix it? Example: I have an ArrayList where I keep several movies in a table (Jtable) where I remove the movies so I do not have them and I have a method to remove a mo...
asked by 21.09.2016 / 17:16
1
answer

Function that counts number of vector elements [duplicate]

I tried to use this function to count the number of vector elements, but it does not work. int tamanho(int *p) { return sizeof(p) / sizeof(int*); } I wanted to pass for : i< tamanho(vetor) . That's how it worked:...
asked by 03.10.2016 / 14:49
3
answers

Searching in an array in javascript

How to do a search within an array in javascript? The solution I use is a gambiarra. x = ['a','b','c','d']; if ( x.indexOf('a') != -1) { console.log('Verdadeiro'); } else { console.log('Falso'); }     
asked by 04.09.2016 / 05:26
1
answer

Unread array with index defined in input

see below the following code: <input type="text" id="task" name="task[]" value="100" /> <input type="text" id="task" name="task[]" value="110" /> <input type="text" id="task" name="task[]" value="120" /> And in jquery, I r...
asked by 19.09.2016 / 16:15
1
answer

Doubt about PHP array

I am having a question about separating a content from a text file and separating it with array . For example, I have the following texts: TEXTO1 <head> <edic><Diário Gaúcho 12/05/2013</edic> <autor>Denise W...
asked by 17.10.2016 / 21:13
1
answer

foreach with multiple variables

I'm trying a foreach with several variables got like? $record = array(); foreach($resultCustomers as $group) { $record[$group['CODIGO_CLIENTE'].$group['RAZAOSOCIAL']][] = $group['NOME']; } $output = array(); foreach( $record as...
asked by 11.07.2016 / 21:59
1
answer

Array receiving two objects

I have two objects and I wanted to create an array this way = > [{"loj_codigo":2,"loj_fantasia":"teste 1"},{"loj_codigo":1,"loj_fantasia":"teste 2";}]} I'm getting the following objects = > Object {1: "1", 2: "2"} Object {1: "teste...
asked by 13.07.2016 / 04:00
1
answer

Multiple keys / values in a javascript array

In a certain part of my code I need to make a request using javascript with several identical ids. The problem is that it is overwriting the ids with the last one selected. My Html: <button class="btn btn-default border-none" v-on:cli...
asked by 06.10.2016 / 16:26
1
answer

Create the same function in php

I have the following function in javaScript : function teste(ctrl) { var str = ctrl.value; var str = str.split(" "); if (str.every(isBigEnough) && str.length >= 2) { alert(true); } else { alert(fals...
asked by 07.10.2016 / 20:57