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
votes1
answer90
viewsHow to print the prefixes together with the array?
I would like a help to print an array with its prefixes. this.prefixo = [ { "E01":[{"name":"Teste01"}], "E02":[{"name":"Teste02"}] } ]; I would like to print the prefixes and the names related to…
-
0
votes2
answers73
viewsArray with inputs and a specific data!
only here to settle certain things. I’m breaking my head to make this loop but I haven’t got it yet. How do I put the highlight in this array() and only 1 of these photos will be marked with the…
-
0
votes2
answers207
viewsHow to create multiple vectors dynamically with Javascript?
I get on the input screen a value, and I need to build the amount of arrays according to the number I received. Example: I get 64 in the input, so I need to create 64 vectors (arrays)
-
0
votes1
answer104
views -
0
votes2
answers119
viewsI converted a two-dimensional array to an object in PHP. How to access the values?
Hello, I have the following matrix: $array[0]["nome"] = "nome exemplo"; $array[0]["idade"] = "idade exemplo"; $array[1]["nome"] = "nome exemplo 2"; $array[0]["idade"] = "idade exemplo 2"; I created…
-
0
votes3
answers1265
viewsHow to fill an array of another class in JAVA
Guys, I created a method within a class that searches RS in the database, it works perfectly, but when I use it in another class, it does not do what you want, see the method: public void…
-
0
votes1
answer70
viewsArray with Mysql
I’m trying to make a draw of songs but it always displays the last song registered in the database $sql = "SELECT nome FROM CadMusicas"; $result = mysql_query($sql, $conecta); while($consulta =…
-
0
votes1
answer396
viewsKnow how many elements I have in an array in Arduino
I have an ARRAY of at most 100 row by 2 columns, which will be filled by a user. My program will play user activity after. What I want to know is how to know how many lines were filled with data.…
-
0
votes2
answers1460
viewsStarting an Array of a private attribute in another class
I’m doing some exercises and I came across a problem, follow part of my code: class Empresa{ public String nome; public String cnpj; private Funcionario[] empregados; public String rua; public…
-
0
votes0
answers40
views"change-making" algorithm - Smallest amount of currencies possible
Given the Change-Making algorithm: change(C1, C2, ...., Cr: valores de denominações de moedas, onde C1 > C2 > ... > Cr; n: inteiro positivo) for i := 1 para r di := 0 {di conta a…
-
0
votes1
answer373
viewsRemove value from an array
My array is mounted as follows: obstacles = [[x, y], [x, y], ...] I am wanting to remove a position [x, y from the array] But the function obstacles.remove() is turning off the server when run, if I…
-
0
votes2
answers363
viewsCalling value from another page
Hi, guys. I’m having a little problem with passing data from one page to another. I’ve tried by Session and not quite sure and I’ll explain why: I have a news page that distributes them by a for in…
-
0
votes0
answers40
viewsCreate an arraylist in one class and use it in another
My problem is the following I have a class that contains an arraylist, I need to use the objects of this arraylist in another class. I’m having trouble creating it. I’m new and haven’t touched it…
arrayasked 8 years, 5 months ago Robson Silva 11 -
0
votes1
answer406
viewsplace name in columns from an object array
public class TableModelAgendamento extends AbstractTableModel { int contador = 1; int qtdFuncionario; private TOFuncionario[] func = new TOFuncionario[qtdFuncionario]; String coluna[] = new…
-
0
votes1
answer261
viewsPHP convert a sentence with and commercial (&) in array
Has a native PHP function that converts a Querystring to Array Example: page=index&produto=115&usuario=2 Array( [0] => 'page=index', [1] => 'produto=115', [2] => 'usuario=2' ) I…
-
0
votes0
answers246
viewsHow to exclude elements from a registry vector in Pascal
I’m doing a work for the course, and every time a person typed a value from an index of the record vector element, all the data from it was erased, would that be possible? If so, how do I?
-
0
votes3
answers1132
viewsProblem with vector in C
I don’t know where it’s wrong, if I put the value 7 in matrizA and 7 in matrizB and 14 in matrizC that will accumulate the value of A and B, for sure but if I place above 14 error. Make a program to…
-
0
votes1
answer47
viewsstr_replace only replaces the second array
Hello, I have a problem that I’ve tried to fix in many ways, but I can’t! I’ve searched the function str_replace() in the php.net and nothing! I have the following code: $cod = '192.168.1.1'; $char…
-
0
votes0
answers39
viewsI cannot assign a value to the last element of an array
struct Numero{ ishort num; Paragraph *next; }; ishort array[3]; array[0] = grid1; array[1] = grid2; array[2] = grid3; array[3] = grid4; ishort i = 0; Numero *n; Numero *t; Numero *h; //lista…
-
0
votes1
answer62
viewsDeclared variable in viewDidLoad not found in Button - Swift 2
I have an array that generates a word when loading the viewController, and saves a random position in the variable declared in viewDidLoad or before inside the class. But inside the button you…
-
0
votes1
answer413
viewsCheck array keys
Next, I have a value saved array in the variable $chaves as the example below: array(2) { [0] => array(1) { ["chave"] => string(1) "1" } [1] => array(1) { ["chave"] => string(1) "3" } }…
-
0
votes0
answers47
viewsRemove a certain value from multiple rows in a table?
I’m having trouble creating an algorithm to scan and delete certain emails from email groups. I have a table where company emails are registered that are displayed on the intranet, with these values…
-
0
votes1
answer4482
viewsHow to get the index number of an array?
I have the following array: Array ( [CPF_CNPJ] => Array ( ) [TIPO] => Array ( ) [NOME] => Array ( ) ) I know that key(array) me returns the current key NAME in a loop, but would like to get…
-
0
votes2
answers615
viewsHow to find out if an array is multidimensional or not in PHP?
I have these two arrays down below: $a = [1, 2, 3]; $b = [1,[2, [3, 4]]]; I know that $a is a array one-dimensional, and $b, multidimensional (array of arrays). Now, how could I discover, through a…
-
0
votes2
answers231
viewsMultidimensional array in C# equal PHP?
First time here on this forum, I usually use stack overflow but come on. My question refers to the array in C#: I’m more familiar with PHP and in php we can name our array indexes for example:…
-
0
votes1
answer426
viewsHow to change the size of a global structure vector in C?
My idea is to declare a global vector of a structure x, but I will only have the size of the vector in main. How can I declare the vector and then tell how big it is? I have an equivalent solution…
-
0
votes1
answer669
viewsCompare two arrays with PHP
I am developing a project where I need to compare two arrays and organize the values. Example: # Objeto 1 $array1 = [1, 2, 3]; # bjeto 2 $array2 = [2, 1, 3]; I need to show the user a list of this…
-
0
votes1
answer178
viewsSending AJAX and PHP array
I am trying to reorder a list of items, which when clicking a button releases the reordering and when clicking again it saves, but if I do more than one reordering it only accepts the first one.…
-
0
votes1
answer643
viewsGet item from an array with jQuery
I have the following structure: [{tabela: 'tabela1', coluna: 'coluna1'}, {tabela: 'tabela2', coluna: 'coluna2'}] I need to insert this data into a div in format: [TABLE.COLUMN] In case it would:…
-
0
votes1
answer46
viewsHow to mount key vaue array pair to insert into table?
$key = "id,name"; $val = "'$lastid','$autor'"; ... if ($email){ $key .= ",email"; $val .= ",'$email'"; } ... $keys = \explode(',', $key); $vals = \explode(',', $val); $arr =…
-
0
votes1
answer54
viewsAdd values in an array with javascript for update
I need to do a user editing in PHP + javascript, but as I am layman in javascript I do not know how to build the function javascipt since I can have different values within the form. My form was…
-
0
votes1
answer191
viewsHow do I add values to an array?
Well...I know how to add values to an array. Actually, that’s not quite it. I have been learning java for a short time and started working with netbeans. The teacher asked for an activity to create…
-
0
votes4
answers2799
viewsString reading with two or more names
How do I read a string with a compound name for example: "Vitor Martins"? I’m doing this program that stores a student’s name and note but it gives a bug when you type two names.…
-
0
votes1
answer1283
viewsHow to put variable inside quotes in javascript?
I need to make this code work. But every time I put the variable in place or inside "" it doesn’t work. //jvectormap data var visitorsData = { "US": 398, //USA "SA": 400, //Saudi Arabia "CA": 1000,…
-
0
votes1
answer7041
viewsFunction that counts number of vector elements
I tried to use this function to count the number of vector elements, but it doesn’t work. int tamanho(int *p) { return sizeof(p) / sizeof(int*); } I wanted to stop by for: i< tamanho(vetor). It…
-
0
votes3
answers5404
viewsHow to create an array with Object from an SQL query
I need the following result within a variable from a query PHP + Mysql: array(1) { [0] => object(stdClass) #1 (3) { ["id"]= > string(2) "1" ["nome"] => string(5) "teste" ["email"] =>…
-
0
votes2
answers191
viewsHow to migrate data between views using Tab Bar Controller (Swift)
I have a Tab Bar Controller with three buttons. How do I take an array, loaded from data stored in Core Data, from a view (button 1) to another view (button 2)?
-
0
votes1
answer244
viewsCounting Numbers using Array in C
How to count integers using a C array in this model: Input > two strings with "integers" ex: 8 15 Output > A string with range numbers, inclusive: ex: 8 9 10 11 12 13 14 15. Probably a basic…
-
0
votes2
answers279
viewsMemory error when generating spreadsheet with Phpexcel
I am having problems in generating Excel spreadsheets using Phpexcel when the number of records is too large the memory is insufficient to process the task, there is some way to improve the creation…
-
0
votes1
answer89
viewsInclude variable in json output
if($_GET['operacao'] == 'banners'){ header('Content-Type: application/json; charset=utf-8'); $rs = $mysqli->query("SELECT foto AS image FROM banners"); $registros = mysqli_num_rows($rs); $arr =…
-
0
votes2
answers32
viewsHow to expand an array_shift beyond the amount of indexes?
I have a question. I put the code just below before starting a while but inside the loop, calling the array_shift($cores), it applies the classes while loop is <= the number of indices, that is…
-
0
votes1
answer2095
viewsCatch the index of the array in the foreach
I have the following class CarrinhoDao.php creating an array of objects from Carrinho.php that creates a class object Produto.php I’m making a foreach in the resulting array: <?php require_once…
-
0
votes1
answer211
viewsArrayindexoutofboundsexception error while executing code
My code is giving the following error: Exception in thread "main" java.lang.Arrayindexoutofboundsexception: 10 at t151.main(t151.java:19) What it means and how to fix? Follows the code: public class…
-
0
votes1
answer787
viewsInput values into the matrix
I have the following code that reads a 10x10 matrix: public class t151 { static final int n = 10; public static void main (String[] args){ int A[][] = new int [n][n]; int i,j; for (i=0; i < n;…
-
0
votes1
answer538
viewsHow to do a ternary <checkbox> check with PHP?
I’m doing this field check <select> and everything is going well but I would like to do the same check on a <checkbox> who may have several possibilities then needing to work with arrays…
-
0
votes3
answers528
viewsFunction that returns the position of the smallest number in a vector
Simple... I need to know what the position of a value (the lowest value) within a vector, to find the lowest value I am using the Math.min()but to print the result I need to know at which position…
-
0
votes2
answers153
viewsWhy does it not read the string matrix?
I am creating a code that for now needs to read the name of N companies (whose N is given). I’m trying to enter the names but the program just doesn’t read and it’s the first time I try dynamic…
-
0
votes2
answers146
viewsView report separated by date groups
Staff I plan to display a report separating the results into date groups as example below | REF. | NOME | DEBITO | ===================================== | X741852 | MARIA | 2.500 | | B890656 |…
-
0
votes1
answer793
viewsJS - display elements on the screen from an object
I need to assemble a questionnaire on the screen with questions and alternatives brought from a database, it is possible to mount the screen with label and radiobuttons without putting a foreach in…
-
0
votes1
answer83
viewsArray ? How to resolve
There is this site that I am setting up where I made a junction of a code that insert watermark with a form where it would be possible to choose which brand would be superimposed on the image that…