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
answer99
viewsHow to treat an array with N lines and turn to a list to send to C#
I’m sending an array of angular js for the controller of C#, and I’m treating him with stringfy for json. Only in my way POST he gets nothing, just returns null Code C# public void Post(string…
-
0
votes1
answer91
viewsPicking indexes with equal keys from a non-associative array
How do I pick/group indexes with equal keys of an array, example: Array ( [field_label] => Array ( [0] => Texto [1] => Checkbox [2] => URL ) [field_type] => Array ( [0] => text [1]…
-
0
votes2
answers559
viewsGrouping an array’s value in PHP
I have the following array: Array ( [0] => stdClass Object ( [anomes] => 201601 [codreg] => 41 [nomreg] => PR [codcin] => 1 [nomcin] => OUTROS [valven] => 6835.7000 [qtdven]…
-
0
votes1
answer584
viewsAccess row and column of an array
I’m a beginner in php. My code reads a csv file and stores it in an array. The problem is that I can’t access the columns. I’m using php 5.3.3. Does anyone know how to pick up the row and column?…
-
0
votes1
answer452
viewsCells with vectors in C, is showing the elements that have already been removed
How do I show my vector without the numbers that have been removed? 'Cause when I show him, even if I take a number off the function, he still shows up inside. #include <stdio.h> #include…
-
0
votes0
answers22
viewsArray splits itself when the elements inside it pass 100 during the api post
I’m trying to post for my api but when the amount of items in my array exceeds 100 it splits up like this: But my api only accepts this array when it gets like this: What I should do for the array…
-
0
votes1
answer80
viewsChange Javascript iterative select background color
Hey, you guys. I’m having a hard time changing the background color of multiple selects iteratively. I can already change, but I have to manually specify the element index for this to happen. Here’s…
-
0
votes1
answer43
viewsSend Cart Session by email with Phpmailer
I have this code that shows the results of the items in the cart <?php session_start(); require_once "functions/product.php"; require_once "functions/cart.php"; $pdoConnection = require_once…
-
0
votes2
answers476
viewsRead csv file that has header and column with commas
I’m trying to read a document **csv and save to an array**, but the problem is that the fourth column of the file csv that I am reading, has a comma separated text, and this causes when I read the…
-
0
votes1
answer74
viewsArray key filled with an expression coming from an SQL query
What exactly does that mean? Array ( [0] => Array ( [MAX(nr_ficha)] => 13 ) ) I gave one print on the screen and saw that my foreign key (nr_ficha) is receiving value 13 (which yes, is the…
-
0
votes1
answer25
viewsArrays comparison or best method to add new elements
I have a webservice in json that returns me the last people who passed in a certain location. That said I did the following: I only ask for the api always the information of the last person to pass…
-
0
votes0
answers103
viewsString vector condition error in C
I’m having a hard time with a specific exercise: #include <stdio.h> #include <stdlib.h> #include <locale.h> #include <windows.h> #include <ctype.h> #include…
-
0
votes1
answer991
viewsHow to join two vectors in another that does not have repeated values?
I need to make a program that reads the values of two vectors R and S, and store its values in a third vector called V. The detail is that it cannot contain any repeated element in the vector V. I…
-
0
votes1
answer95
viewsHow to scroll through an array the right way
Good evening guys, I’m having an immense difficulty regarding arrays... I have the following array: array(6) { [0]=> array(1) { ["cep"]=> array(2) { [0]=> string(8) "15070650" [1]=>…
-
0
votes0
answers66
viewsWhen printing string, meaningless characters are shown
I need to do a program that calculates the average salary of a company, asking the user for the amount of employees, the name and salary of each employee and returning the average, the name of the…
-
0
votes1
answer154
viewsOrganizing month order in a php array
I used the function below to organize the orders of the months in ascending order, it works perfectly, but it loses the keys, when it creates the new array organized, keys start from 0 (zero) again…
-
0
votes2
answers62
viewsGreater amount of appearances of an element in an object array - Javascript
Hello, I have a news array(objects) lista: Array<Noticia> = []; From this array I need to find the author who has published the most news. A news has: ID | Title | Tags | Author | Contents. My…
javascript angularjs array algorithm typescriptasked 6 years, 2 months ago Arthur Gabriel Silva Arantes 51 -
0
votes0
answers24
viewsFile_put_contents writes only half of the data
So I’m having a little problem with my code, query, for, foreach and if work perfectly. However, file_put_contents only writes half of the reported data. My goal with this code is basically to make…
-
0
votes1
answer289
viewsGroup the values of a PHP array according to the same key.
Good afternoon, you guys, I know the question may seem repetitive, but I’m already a while looking for the solution to my case, especially here in #stack. I got the following Array(): array (size=9)…
-
0
votes2
answers57
viewsif with array listing
I’m getting beaten using arrays, I need to check values and make decisions depending on what I find in the list. id | volume_total | volume_entregue | volume_restante 1 15 10 5 2 10 10 0 My problem…
-
0
votes1
answer165
viewsWhite space at the end of each array index?
I’m performing a line break without using the function wordwrap(). I will receive a string with the text, and an int with the allowed character length per line as parameter. I’ll have to cut that…
-
0
votes1
answer98
viewsAccess data within PHP array
Hey, guys, all right? I have a problem with a project I’m working on. I receive a form where the user informs the data but in this form, it is possible that he click a button to insert new inputs…
-
0
votes0
answers39
viewsWhy isn’t my condition giving me the expected result?
I’m performing a line break without using the function wordwrap(). I will receive a string with the text, and an int with the allowed character length per line as parameter. I will have to cut this…
-
0
votes3
answers1090
viewsarray in a php foreach
I’ll try to be objective in doubt: I have the following code: <?php foreach ($modelo as $k => $v) { $sql_ = "SELECT * FROM pedido WHERE modelo LIKE '%".$v."%' ORDER BY id ASC"; $disp_sql_ =…
-
0
votes3
answers144
viewsDoubt - Array php return
I’m a beginner in php, and I came across the next problem. I have a function that returns me an array that comes from the database. $teste = dados($conexao); And I do: print_r($teste); It returns me…
-
0
votes2
answers206
viewsSplit Double Python Array
I need to get coordenadas cartesianas and separate them so that you know what the ordered pair is. I receive a string where the dots come this way: x0,y0 x1,y1 ... xn,yn I used a array split by…
-
0
votes1
answer60
viewsView array data
I need to display this data array and I don’t know how to make the call. I would like to take specific data such as [Postage] => 140.55 [0] => SimpleXMLElement Object ( [@attributes] =>…
-
0
votes1
answer56
viewsTreating array with php to Laravel
I need to recover the first array from this list of arrays. I need to recover BTC and LTC, and the attributes rate_btc, tx_fee and name. array(1029) { ["BTC"]=> array(9) { ["is_fiat"]=> int(0)…
-
0
votes0
answers199
viewsHow to create a String Array from a String Array and an Integer Arraylist?
I am creating an application that will need to store the specialties of each clinic registered in the application, these specialties later I will be in the database of Firebase, I am using a dialog…
-
0
votes0
answers18
viewsError with search bar - Ionic
Pedido.ts : getItems(ev: any) { const val = ev.target.value; if (val == '') { this.clientes = null; } else if(val && val.trim() != ''){ this.buscarUsuario(ev); } selectItem() { this.clientes…
-
0
votes2
answers62
viewsComparison of lowest value in list
My problem seems to be simple but it’s bugging my head kkk, there it goes: When I compare my Values list to find the lowest value, it always returns 0, what happens sera? Follow Cód below. Obs:…
-
0
votes4
answers370
viewsI don’t know how to use the method of converting images in Xamarin.forms.
I’m developing an app Xamarin.Forms and I’m having difficulty understanding how to fill the parameter to convert an image into byte array, I searched a lot looking for some solution, I found this…
-
0
votes2
answers1083
viewsHow is the logic to print the numbers in ascending order in C
I created a code that takes a certain number set by the user, and makes the separation of pairs and odd, until then I was able to do, my problem is to put the numbers in ascending order so that the…
-
0
votes1
answer115
viewsUndefined object reference for an object instance. Array
Hi, My problem is in the array following this code: mesh meshCube; string[] file = File.ReadAllLines("object.mind"); foreach (string filetext in file) { if (filetext.Contains("v")) { string ext =…
-
0
votes2
answers811
views"Illegal string offset" error when calling usort in database data
I am trying to sort the result by a specific column of a database array. function cmp($a, $b) { return strcmp($a['usu_codigo'], $b['usu_codigo']); }; usort($usu_info_coluna, "cmp"); Giving a…
-
0
votes1
answer1055
viewsAlphabetizing an object array
I have an array of objects and want to put in alphabetical order but I’m not getting by javascript, I’ll put as the array is structured and the code to call on the page var json = [ { "ID":"1",…
-
0
votes1
answer36
viewsRecover values from an array of the next line in the previous line
I have an array in the format below: Array ( [0] => Array ( [A] => 000001001000003001 [B] => VLR REF COMPENSACAO DE VENDA CONFORME CO1 [C] => 1.1.2.01.020001 [D] => Z4 [E] => [F]…
-
0
votes1
answer119
viewsError reading txt file line by line
I’m having trouble reading the dist1.txt file and can pass the values of each line and pass to an array of the other class. The file has the following format . txt: 1;1;00 1;2;14 1;3;05 1;4;05…
-
0
votes1
answer522
viewsAssign values to a struct array in Golang
I’m starting to learn go and need to populate the different structs with their values. I thought about creating an array of structs and trying to use a for to fill the fields but give an error of…
-
0
votes1
answer184
views -
0
votes1
answer92
viewsHow to list all xml for php
Good evening. I have the following xml file: <MusicHistory CompactMode="1"> <Item0 Block="2018-02-11T23:00:00" Folder="Musicas" Music="Zara Larsson - So Good" Composer="" Comment=""…
-
0
votes3
answers176
viewsPrint result of an array in php list format
I have two arrays in php, which I compare and create a third and want to print this difference on a list. I’ve tried the foreach, but this method prints a huge list in string. This is my code: $sql…
-
0
votes1
answer224
viewsHelp in Javascript contact list program
I have to make a simple Javascript program that will show the user’s contact list and allow him to enter a new contact, as in the image below and the description of the problem is as follows: Each…
-
0
votes1
answer385
viewsSwap the first and last element of an array by creating a new array
Why the value of Numbers[0] changes to 3 after executing the code line below? New_Numbers [0] = Numbers [Numbers.length - 1]; The complete code: public static void main(String[] args) {…
-
0
votes1
answer62
viewsLimiting Array via POST
Guys, I was picking up on my code always giving offset error and things like that, when I discovered that somehow my array is not coming complete. I have a form, where it is fed according to the…
-
0
votes2
answers67
viewsHow to compare 2 arrays to find which value is missing in one of them, using PHP
I have 2 arrays and need to make a comparison between them, to find what values are missing in the 2nd array ($arrayxml), for example: $arraybd=array('1','2','3','4'); $arrayxml=array('1','2'); In…
-
0
votes1
answer850
viewsHow to organize an array for odd numbers before even numbers?
I’m trying to make a program that organizes an array to put the odd numbers before the even numbers, this was my attempt, what I’m doing wrong. Code: System.out.print("Indique o número de elementos…
-
0
votes0
answers32
viewsDelete chosen file from a list and subtract from the total value - Ionic
I’m developing an app with Ionic 3 and Firebase. I am facing problems, because it is not decreasing the value of the product(chosen) of the total. Always subtract the last value informed. Follows…
-
0
votes1
answer45
viewsPrinting items from an associative array randomly
I’m creating a carousel, where there will be 3 sliders containing 15 images inside each, totaling 45 images. I created a array associative to display these images randomly, so far so good, however,…
-
0
votes1
answer395
viewsNull Pointer Exception?
In the code snippet below, you are supposed to compare the value of the items in the array linhas with the String inserted by the user p. It’s working, but there’s always the error: Stack trace -…