Questions tagged as 'array'

2
answers

How to compare two arrays and return the difference between them?

I have 2 arrays that come from 2 different banks, one comes from the sql server another from mysql. Mysl query returns like this .. array (size=6) 0 => string 'ultimoteste3' (length=12) 1 => string 'ultimoteste3' (length=12)...
asked by 26.01.2016 / 12:43
1
answer

What is the elegant way to read this PHP Object?

I have Result of a Webservice below, I'm doing some foreachs to read each level of the class, but I think you should have a more elegant way of reading and getting the values of the object, follow Result : stdClass Object (...
asked by 29.01.2016 / 12:58
2
answers

How do I pass an array as an argument to the user by setting the number of columns?

I will make a simple program just to exemplify my problem. #include<iostream> using namespace std; void recebeValor( int mat[][col]) // me da erro de comp; { mat[0][0] = 2; cout << mat[0][0]; } int main() { cout << "E...
asked by 23.11.2015 / 20:29
3
answers

How to insert index and element into an array

I am developing a loop to compare two tables in a database. The intention is to know how many people were indicated by a same employee of the company. For this, I need to start an array as follows: foreach($linhas as $linha){ $varivael = a...
asked by 04.05.2017 / 17:16
3
answers

sort array multidimensional php

I have the following array returned from a webservice (in the image I identify what I want, below the text to copy paste if necessary): Array([DataTable]=>Array([ID]=>STOCK[Line]=>Array([0]=>Array([Fields]=>Array([0]=>Array([F...
asked by 27.04.2016 / 17:54
1
answer

Array size

How do I get the size of an array with this structure: A = { ["b"] = {c=1, d=2}, ["e"] = {f=1, g=2}, } I want to get the size of A, in this case, 2.     
asked by 21.09.2014 / 08:04
4
answers

Assigning Arrays in Java

I own two String Arrays and I have to compare them. After the comparison I must assign the repeated values in another Array. My problem is that I want to assign just the repeated Strings without the Strings that do not repeat. Code: //A...
asked by 16.07.2017 / 19:56
1
answer

How to convert array keys to all uppercase or lowercase?

I'm getting data from a Webservice , through a response in JSON. Convert this data from JSON to array , via json_decode . But one thing that's bothering me is the fact that the keys are coming with the name in CamelCase....
asked by 23.08.2016 / 15:41
2
answers

Sort method is not sorting correctly

I have the following code: #include <bits/stdc++.h> using namespace std; int main() { int n, cases = 1, a[3]; cin >> n; while(cases != n + 1) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 2); cout <...
asked by 08.07.2016 / 08:31
1
answer

PHP array of objects without access to get

I'm trying to access the getters that refer to an object, however this object is in an array, and by no means do you want to access them. Here is the class DAO (where you are giving the mess and I am doing test) and class VO: DAO: <?...
asked by 14.07.2015 / 05:08