Questions tagged as 'array'

0
answers

Get information from an array inside a foreach - PHP

Good afternoon. I'm developing an application with PHP using Laravel, and I'm having a hard time. I have a table with the name of Account, in which it has the code of this account, represented by the variable $ client-> Code, also has the...
asked by 28.10.2017 / 17:55
2
answers

MarketPay API

I'm making a cart system here to test the MercadoPago API. Everything is working except for the part of creating the payment that I have no idea how to start. MercadoPago API I'm not very good at messing with arrays, and I'm here to ask...
asked by 11.12.2016 / 15:05
1
answer

Mount array with txt data

I am trying to find a way to set up a table with the data of a txt, but I do not know how to separate the values in the array, since they are separated by several spaces, but are identified by fields (Name: : ...); Example of a txt file: C...
asked by 21.08.2014 / 20:16
3
answers

What is the difference in checking an array with isset and array_key_exists?

In PHP we often have more than one way of doing the same operation. A basic example is in checking for the existence of a given index in array : we can use array_keys_exists . Example: $arr = ['a' => 1, 'b' => 2]; var_dum...
asked by 10.03.2016 / 17:30
4
answers

How to handle vectors in a MySQL database?

I have a supermarket carton application where after the end of the sale needs to insert a record with data referring to that sale in a table, this record should include the code of the products bought and the quantity of each. As I'm using a...
asked by 12.12.2013 / 14:13
6
answers

How to remove 2 digits from each list item?

I have a list / array: var lista['01.um','02.dois','03.tres'] I need to create a new list like this: lista['01','02','03'] I know little about Groovy and Java, what is the correct way to create the list?     
asked by 19.06.2016 / 20:55
4
answers

How to return the last record of an array with Javascript or jQuery?

I'm doing a custom search filter where the user can select the brand and the characteristics of the product and I return the id of them. But I wanted to return only the last record of my arrays where they contain all the information I need....
asked by 17.09.2015 / 14:43
4
answers

How to mix an array in JavaScript?

In PHP, when I need to mix an array, I use the shuffle function. So: $a = array('@wallacemaxters', '@rray', '@CiganoMorrisonMendez'); shuffle($a); print_r($a); output: Array ( [0] => @CiganoMorrisonMendez [1] =>...
asked by 26.10.2015 / 16:57
5
answers

How to use the reduce (reduce) operation on objects?

In Javascript, when I need to do a reduction operation, I use the Array.reduce method. So: var valores = [1, 2, 3, 4, 5, 1000]; var resultado = valores.reduce(function (soma, atual) { return soma + atual; }) console.l...
asked by 13.11.2017 / 12:44
3
answers

Check if array contains specific character

I need to check if an array has a specific character (this: |). If it contains, this character must be deleted, and the next word that would be after that character (which actually is a separator of items) would be added in the next index. That...
asked by 14.12.2018 / 03:05