Questions tagged as 'array'

3
answers

PHP- Table with repetitions in loops using multidimensional array

Hello, I need to make a table like the but using this array: $teste = array(); $teste[0]['produtos']['nome'] = "Produto 1"; $teste[0]['produtos']['descricao'] = "Descrição do produto 1"; $teste[0]['produtos']['valor'] = 50; $teste[0]['produ...
asked by 04.10.2017 / 03:15
1
answer

Identify repeated indices and exchange only one of them

I have the following vector: a = [1, 2, 3, 4, 1, 3] I need to go through this vector and identify the repeated values. After identifying them, I need only one of them to be changed by a random value between 1 and 11. For example: T...
asked by 13.09.2017 / 03:07
2
answers

How to get values close to the given offset of an array?

I'm having a hard time extracting a portion of any sequential indexed array, such as a simple range () . The problem is that I need to specify a start offset and a limit greater than or equal to 1. This limit would control how many elements...
asked by 06.08.2017 / 01:33
2
answers

Operations with arrays in C ++

To sum the items of an array (primary diagonal and secondary diagonal) I was able to write the following code. Can someone help me make the code leaner? so I compare the codes ... C ++: And I would like to know if there is any function for this...
asked by 07.08.2017 / 00:49
1
answer

jQuery read json and display sub-levels only if they exist

I would like to do a validation, make a for the first level and second level of a json, the second level should be printed only if there is this second level in the item of the current array. Ex json down: content = { "primeiroNivel0": {...
asked by 12.07.2017 / 22:58
1
answer

Registration in foreach php

Alright? I am trying to register several records in the bd according to the number of parcels requested, but I am not able to. My code: php: $Conn = parent::getConn(); try { foreach ($this->Data as $pr): $Query =...
asked by 03.07.2017 / 22:06
2
answers

Can not set property 'innerHTML' of null

I tested the code below and it returned the error: p1-rad1-RE_UP.html:35 Uncaught TypeError: Cannot set property 'innerHTML' of null at Object.listarTodos (p1-rad1-RE_UP.html:35) at p1-rad1-RE_UP.html:100 p1-rad1-RE_UP.html:35 Uncaught...
asked by 20.04.2017 / 14:58
1
answer

How to Clone Array

I'm wandering about a means of getting all elements of the array in question back, all over again. See this my source code below: Code <html> <body> <button onclick="next()">APAGAR</button> </body...
asked by 18.03.2017 / 20:32
1
answer

password confirmation on c

I need to register N people in my program with only two information: name and password. After the user enters a name, if this name is not registered the program displays a non-registration message and closes, but if it is registered it asks the...
asked by 10.04.2017 / 05:36
1
answer

Show age between 20 and 30 in an array - javaScript

I would like to create a function as simple as possible that it receives an Array of Person objects (example format: {name: "Alex",age: 24} ) that returns a new array only with Person objects that are aged between 20 and 30 years. My...
asked by 06.03.2017 / 21:24