Questions tagged as 'array'

3
answers

Array passing as a parameter of a function

I want to get the array containing the numbers 3, 15 and 23 and with an output array display twice. But it is giving the following error:   Warning: Missing argument 1 for creating_array (), called in <?php function criando_array($...
asked by 04.03.2015 / 02:56
1
answer

What does the for and what makes the brackets in an array?

I asked for help in some forums in a game of the old programmed in Java, I understood the logic, but I did not know how to apply it (what commands to use, and how to use it), and I saw the use of Arrays. After seeing a complete code, I understoo...
asked by 03.06.2014 / 04:36
2
answers

Generate unique color for each result

So .. I have a system of comments anonymously in a project of mine that in place of the avatar it puts the abbreviation of the name of the person, for example: Vinicius Eduardo -> VE and I want to create a system or function that generat...
asked by 19.06.2014 / 03:28
2
answers

What is the difference between joining an array via sum operator and the array_merge function?

To join two arrays in a new array in PHP, we can do it through the array_merge function or through the sum operator ( + ). In this case we have two examples: $a = ['stack' => 'overflow']; $b = ['oveflow' => 'stack'...
asked by 27.02.2015 / 14:24
2
answers

How to get 2 PHP arrays and join in 1 string

I have 2 arrays in PHP that come from a form $_POST['qtd'] and $_POST['ing'] : array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } array(2) { [0]=> string(1) "a" [1]=> string(1) "b" } How can you put them togethe...
asked by 10.09.2018 / 21:42
2
answers

How to compare the contents of two vectors?

public class VetorTurma { public static void main(String[] args) { int pontuacao = 0,nota,c; String nome; Scanner sc = new Scanner(System.in); double gabaritoVetor[] = new double[10];...
asked by 14.02.2016 / 02:35
2
answers

Pointer changes address when exiting function

When performing a dynamic allocation of a vector or matrix in C, the pointer referring to this allocation changes address when leaving the function, whereas before it was pointing to the initial address of the allocated area and soon after the e...
asked by 09.11.2016 / 20:17
2
answers

How to create a vector whose indices are characters of an informed string?

I wanted to create a vector in java in which each index of the vector was a character of a string that I / public static void main(String[] args) { String[] words = {"java"}; System.out.println("\n"+words[3]); //para dar um print na...
asked by 14.11.2017 / 01:17
2
answers

Invert array (vector) without an external function, 'manually'

Friends, I always inverted vectors using a helper in an external function (I think the default way), but until recently a friend told me that I had a way to invert vectors without using a helper, I asked to show myself but it turned out What did...
asked by 31.05.2016 / 15:05
1
answer

Check duplicate values in array

My question is: I have the following array: $array = array(10, 30, 10, 40, 40); I would like to know if there is a simple way to display the message: "There are duplicate values" or "There are no duplicate values". The arra...
asked by 17.04.2014 / 22:51