Questions tagged as 'array'

2
answers

Problems generating a table with php from a two-dimensional array

Hello this is my code and although I put the rowspan to 3 does not generate the table correctly, I try to generate a table from a two-dimensional array with PHP but when formatting the table does not come out as it should, I can not find the err...
asked by 09.01.2018 / 23:55
3
answers

Convert an array to a string

I have this array [12, 13, 22] but I need to remove the brackets and spaces. You should print the following: 12,13,14     
asked by 15.01.2018 / 01:43
1
answer

Extract random elements from an array in php

Hi, I would like some help or explanation on how to extract more than one result from an array in a random way using php. Until the moment and achieved this code: <?php $N = mt_rand(2,4); $ele = array('#instagood','#love','#beautiful','#me'...
asked by 12.01.2018 / 21:02
1
answer

How to read the Laravel request data

I need to extract what is in request- > itemes Request {#40 ▼ #json: null #convertedFiles: null #userResolver: Closure {#472 ▶} #routeResolver: Closure {#480 ▶} +attributes: ParameterBag {#42 ▶} +request: ParameterBag {#48 ▼...
asked by 29.12.2017 / 13:59
1
answer

The value of variable is deleted when passing it from js to php

I'm doing a shipment by ajax from js to php. I am sending an array of objects using angular, here my code. $scope.updateRecipe = function() { //Se hace petición ajax para agregar el producto $http( { //Se elige el metodo...
asked by 19.01.2018 / 23:35
2
answers

Abnormal foreach behavior in php 7.0, repeat the last element in nested foreach

I'm new here, and as the title says the foreach behaves abnormally. I want to list all the driver's schedules per shift (1 = day, 2 = night), in turn these with the days from Monday to Friday (0 = Sunday, 1 = Monday, etc) Bearing in mind that dr...
asked by 11.12.2017 / 22:46
2
answers

Authenticate in PHP with array search

Hi, I wanted to know how I could make this code, when logging in, compare if the credentials are correct by comparing the values of an array. I did it with a foreach, comparing them with if, but the result that gives me is that everyone can ente...
asked by 23.12.2017 / 22:18
1
answer

Count repeated numbers in an array

I have an array that will randomly have between 500 and 1000 positions. And in each position a value is saved that will be between 1 and 50. To get this array I have created the following functions: //Funcion numero aleatorio entre 1 y 5...
asked by 10.11.2017 / 03:28
2
answers

I do not understand the array in php

<?php $empleados = array( array('Powell, Alfredo','Administrativo',5500), array('Pérez, Verónica','Administrativo',5200), array('Goldstein, Juan','Recursos Humanos',6800), array('Giaccomo, Walter','Recursos Humanos',6200),...
asked by 03.10.2017 / 14:05
2
answers

How to 'defragment' an array to make an insert in the database?

In my controller perform the following arrangement $DataPerson= array( 'documentos' => $this->input->post('documentos'), 'num_identificacion' => $this->input->post('num_identifi...
asked by 22.06.2017 / 18:52