Most voted "array" questions
An array (array, vector, or matrix) is an ordered data structure representing a collection of elements (values or variables), each identified by one or multiple indices.
Learn more…3,046 questions
Sort by count of
-
0
votes2
answers121
viewsCreate an array separated by date groups
People want to create a separate array in groups by date of the result of a query made in DB example: // [...] $sql = $this->db->query($query) or die (sprintf("Falha: %s",…
-
0
votes1
answer195
viewsadd to array after loop
I have some loops in my php and want to get an array like this: Array ( [nome1] => valor [nome2] => valor ) inside a loop I tried : $array_dos_pagamentos[nome] = $variavelnome; and another…
-
0
votes3
answers2196
viewsCheck that the values of an array are all the same PHP?
I would like to check that all values in my array are equal and I did so : $minha_lista = array('a','a','a'); if(!empty($minha_lista)) { if(count(array_unique($minha_lista))===1){ return true; }…
-
0
votes1
answer38
viewsHow to redirect to the same object position after update
I am displaying a collection of random objects in my index action. However the objects are displayed one at a time. So: @objects = Object.order("RANDOM()").limit(1) In the index view, I can send a…
-
0
votes1
answer63
viewsCSV file saved in the database
I have a large CVS file and I need to record it in my database the first line are the fields, which I have to validate if they are right and make some changes for example first line NAME, DATE…
-
0
votes0
answers223
viewsSplit and swap the array key?
When using the function split in a string obviously the keys will be enumerated from 0 to ... but I would like to choose which key should be, using just one of the words that will be in the string,…
-
0
votes1
answer63
viewsDoes anyone know why there’s a glitch in this program?
void ordenar(struct piloto *vetor,int contador_pilotos) { int z,i,x,j; for(x=contador_pilotos-1;x<=1;x--) { for(i=0;i>x;i++) { …
-
0
votes1
answer520
viewsAngularjs, How to create Checkbox to insert array in Mongodb
I created a collection on mondoDB called Sleeves, where you have "name, author, genre and info" Gender is array. I have a form that will receive the values name, author and info, the Checkbox must…
-
0
votes0
answers813
viewsHow to build an Object with an Array inside, using Eloquent Laravel
Hello folks I need to build a array as follows for a plugin: var data = [{ "label": "Follows", "color": "#aad874", "data": [ ["Seg", 50], ["Ter", 84], ["Qua", 52], ["Qui", 88], ["Sex", 69], ["Sab",…
-
0
votes1
answer1324
views -
0
votes1
answer65
viewsUPDATE field BIGINT[] from a SELECT
I have an update to a field permissao_ver Being the same guy bigint[], field response : '{1,2,3,4,5,11,44,56,75,11}' My Query UPDATE callcenter.pausa SET permissao_ver = '{"(SELECT cod_grupo FROM…
-
0
votes1
answer481
viewsCombination of digits from A to Z (Crosse Join)
I’m running a four-digit algorithm from A to Z. I did it using vectors in Pascal like this: var i:integer; j:integer; k:integer; l:integer; vect1:array[1..26] of string; vect2:array[1..26] of…
-
0
votes0
answers30
viewsMethod $_GET[] PHP
I am using the $_GET[] method in php and it is returning the following error: "Do not access the direct Superglobal Array $_GET directly." follows the code: <?php function COMP($Comp, $Lar,…
-
0
votes2
answers206
viewsSelect from an array inside another array
I own a ArrayList which has other ArrayList within it, I got through the following scrip on Groovy: def i0 = listaTransportadoras.get([0]); def i1 = listaTransportadoras.get(1);…
-
0
votes1
answer1062
viewsManage Session as an array
I wanted to know if there is any way for me to save two values in the same variable Session as if it were an array, because I want to save both the value of input text and the wysiwyg element by…
-
0
votes3
answers350
viewsData of an Array
I’m having a little bit of a problem here, the logic I should use for this kind of procedure is a bit complicated. Well, here’s the thing: I have an array with the following data: var dados = […
-
0
votes1
answer4109
viewsConverting char vector to string - C++
#include <iostream> #include <string> #include <vector> using namespace std; int main () { string vet[10], aux; std::vector<char> name; int count=0, sum=0; while…
-
0
votes2
answers510
viewsVector Comparison Problem - Java
I have a problem with a simple code in Java, I just started learning the language. The exercise consists of comparing the values of the vector to see if there are repeated elements. The problem is,…
-
0
votes1
answer232
viewsTake the name of an item within an array in strings.xml
I have the following array: <array name="Codes"> <item name="Vermelho">e74c3c</item> <item name="Azul">3498db</item> <item name="Rosa">FC14E5</item>…
-
0
votes1
answer600
viewsFilter Array and return a new array with the objects that have been filtered
Using Javascript, created a function as simple as possible that receives a _Array_ object Pessoa (example: {name: "Alex", age: 24}) that a new one returns _Array_ only with objects Pessoa between…
-
0
votes1
answer38
viewsGroup values of an array into zones based on another PHP array
Hello, I have two arrays where the $key is the same for the two depending on the time they were registered. The first array is a Timeline in seconds of activity and the second array is the Heart…
-
0
votes1
answer159
viewsSort multiple Object arrays by value
people have the following situation: var input1 = {preco:valor1.toFixed(3), tipo:name1}; var input2 = {preco:valor2.toFixed(3), tipo:name2}; var input3 = {preco:valor3.toFixed(3), tipo:name3}; var…
-
0
votes1
answer664
viewsShow age between 20 and 30 in an array - Avascript
I would like to create a function as simple as possible that receives an Array of Person objects (example format: {name: "Alex",age: 24} ) that a new one returns array only with objects Person who…
-
0
votes1
answer79
viewsEviando responses from a php poll via array to an email using the php mail function
Good morning to everyone, I would like to know if I am receiving the values of my form correctly and sending by email using an array to list questions and answers of the poll. follows the code.…
-
0
votes0
answers156
viewsInsert data from a while mounting the form into the mysql database
how to take the value of inputs that comes by array because it is the form is fed by the client follows the form code, hence how many questions he wants in my poll system, and creates the answers..…
-
0
votes1
answer99
viewspreecher array, struct in C?
how do I fill in leds and seq without needing a loop for? int main() { struct ledvalue { int seq[10]; int leds[10]; }; struct ledvalue numbers; numbers.seq={0,1,2,3,4,5,6,7,8,9};…
-
0
votes0
answers87
viewsPHP: TXT for Multilevel Array
Guys, yesterday I had asked for help on the subject here that, promptly friends helped me, but I faced another problem: Only later I realized that the file . TXT has several levels, and not just 2…
-
0
votes1
answer179
viewsHow do I add id values from a total array
I take 2 results from an array, for example: 1 and 9, these numbers are ID’s that I will use for a query in the database and print these results on the screen, I can even print, but for example if…
-
0
votes1
answer40
viewsProblems in a string array of a structure
I’m having a problem with an array of strings I’m trying to access from a structure. The structure is placed in a header.h which has the following format : typedef struct { char *produtos[200000];…
-
0
votes3
answers173
viewsHow to capture the numbers for a single line array?
I have to write a code in C++ in a question where, first, the user enters a number that determines the size of an array, and then, insert in a single row, separated by spaces, the numbers of that…
-
0
votes1
answer141
viewsTwo-dimensional array size within the C-struct
Hello. I am doing a job I read a txt (the file name is passed by argv[]) and I write a graph. In the first line of the file two parameters are passed as follows: V A These parameters are integers…
-
0
votes1
answer40
viewsI always want to delete the first index every time I click a button. How do I do it?
Seen what I tried: <html> <body> <script> var nome = ['1', '2', '3', '4', '5', '6', '7', '8', '9']; var remover = nome.slice(0); function shuffle(array) { return…
-
0
votes1
answer28
viewsCapturing elements by tag and inserting into an array
Well, I’m riding a carousel on a test project, and I came up with a question, how can I, with vanillaJS, capture certain elements by tag, and put them inside a array ? The idea would be more…
-
0
votes1
answer27
viewsDetecting click elements of an array
If I own a div with id="banner-tooltips", and within it I have n <span> tags declared in variables with javascript, how I can detect the individual click on these span tags ? var caixaTooltips…
-
0
votes2
answers11884
viewsAdd value of an array
I need to sum up the values provided by an array. The array comes from a select in the database. The array is this way: Array ( [0] => Array ( [valorPagamento] => 12 ) [1] => Array (…
-
0
votes1
answer282
viewsHow to remove the first value within an array?
I have the following array: array(3) { [0]=> string(22) "VALOR 1" [1]=> string(10) "VALOR 2" [2]=> string(14) "VALOR 3" } I need to show all the values of this array but delete the first…
-
0
votes1
answer225
viewsAdd items within an array to later save
Hello, I have the following situation and would like a hint if possible how would be the logic to implement this procedure in my application PHP Laravel. I’m creating a stock system, in the drive…
-
0
votes2
answers1348
viewsCompare vector elements in R of different sizes
My intention here is to find the elements in common between a and b. a <- seq(from=1, to=5, by=1) b <- seq(from=5, to=13, by=1) x <- which(a==b) Warning message: In a == b : longer object…
-
0
votes1
answer62
views -
0
votes2
answers1311
viewsHow do list sorted by letter?
I suppose I have a list of names, at array in Javascript. But I’m looking for a way to do it in the suggestion box style, where you only press an alphabetical key inside the field and as soon as you…
-
0
votes0
answers108
viewsError grabbing array by Indice
I have this code and do not know why I return only the first character of the variable(exe: if the login contains the value Diego, print only D) The print_r that is there,I put to test the return…
-
0
votes1
answer40
viewsTake data from array
Good morning I have the following array Array ( [0] => Array ( [ID] => 2 [UltimaAtualizacao] => 2017-04-20 16:15:00 [DataEntrada] => 2017-04-20 [Estado] => Finalizado [DataSaida]…
arrayasked 7 years, 7 months ago Emanuel Trigo 1 -
0
votes1
answer284
viewsHow to search for JSON data in this specific code
I need to do exactly as requested on this post, take Json data and return in a specific field. User Jeffson Silva did exactly what I need and made it available in this Example. Only I ran into the…
-
0
votes1
answer42
viewsHow do I set certain array values for the same value? (Java)
Example, I have a two-dimensional array of type int: int array[][] = new int[10][10]; How do I define the value of, for example [2][3], [6][7] and [1][9] for some same int, without needing to define…
-
0
votes1
answer36
viewsDelete some array results
I need to leave in the array below only the values Yes: 1 and 2 Any suggestions? I tried unset() but it didn’t work. array (size=3) 0 => array (size=4) 0 => string 'Adair' (length=26) 1 =>…
-
0
votes2
answers48
views -
0
votes1
answer105
viewsCombobox loading wrong array information
I made an application in C#(Winforms) to load the marks according to the type of vehicle that is selected (car, bike or walking)in a combobox. I put in a button the following code: private void…
-
0
votes2
answers726
views -
0
votes4
answers457
views4x4 matrix with 20 elements
Galera made a code in Python whose exercise asked to make a 4x4 matrix , show the amount of elements larger than 10 and show the final matrix. I did and everything was fine only that the matrix ta…
-
0
votes0
answers120
viewsInsert an array with codeIgniter and ajax
Hello I am trying to insert an array, but in this case, you can insert multiple lines in db. How do I pass the data to codeIgniter: var productsData = []; $(".productRow").each(function(i){ var…