Questions tagged as 'array'

2
answers

Multidimensional array in C # equal to PHP?

First time here in this forum, I usually use stack overflow but come on. My question is about array in C #: I'm more familiar with PHP and in php we can name our array indexes for example: $array = ["nome"=>"Pedro", "Idade"=>18]; M...
asked by 20.08.2016 / 05:53
2
answers

Pass results from an array in else if conditions

I have the following code: <?php $array = []; $ano = 2016; for($i = 1; $i <= 12; $i++){ $data = $ano . '-' . $i. '-01'; $inicio = new DateTime($data); $fim = new DateTime($inicio->format('Y-m-t')); $dias = $inicio-&...
asked by 21.10.2016 / 18:06
5
answers

PHP array types and values

How do I transform this type of data $pessoas->nome to $pessoas['nome'] and vice versa with php and why are they different?     
asked by 20.08.2015 / 22:53
2
answers

How to compare 2 arrays to find which value is missing in one of them, using PHP

I have 2 arrays and I need to make a comparison between them, to find which values are missing in the second array ( $arrayxml ), for example: $arraybd=array('1','2','3','4'); $arrayxml=array('1','2'); In this case, the values '3'...
asked by 13.11.2018 / 11:00
2
answers

Repeated withdrawal

I have the following code: var e = Array (10,20,30,40, 50); for (i = 0; i <= 50; i++) { for (j = 0; j < e.length; j++) { if (i == e[j]) document.write ("O numero escolhido é: " + i + "<br />"); else document....
asked by 18.10.2018 / 12:39
2
answers

Working with vectors / arrays

Hello, I have the following question, I have 5 vectors string[] Defesa = { "Gigante", "Golem", "Gigante Real" }; string[] AtkTorre = { "Corredor", "Ariete de Batalha", "Gigante Real" }; string[] AP = { "Bárbaros de Elite", "Gigante Real", "P...
asked by 09.04.2018 / 22:37
2
answers

Compare vector elements in R, of different size

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 length is not a multiple of shorter object le...
asked by 24.03.2017 / 18:21
2
answers

Concatenate items in a vector

I have the following vector, which I get after querying a database: a = ['[[10, 20], 10]'] When I try to access their values through the indexes, I can not. For example, if you type: print(a[0][0]) . Returned '[' I've tri...
asked by 12.10.2017 / 01:09
2
answers

Starting an Array of a Private Attribute in Another Class

I am doing some exercises and I came across a problem, it follows part of my code: class Empresa{ public String nome; public String cnpj; private Funcionario[] empregados; public String rua; public String bairro; public int livre = 0; public...
asked by 14.09.2015 / 01:24
2
answers

Compare Python index-independent lists

Good afternoon, I need to compare 2 lists and when a certain value in the 'name' field of list 1 does not exist in the 'name' field of list 2 perform some function. The way I did is comparing index by index and executing if every time the...
asked by 08.08.2018 / 22:49