Archivo de la etiqueta: arrays
Cómo buscar a través de submatrices de manera eficiente en PHP?
$arr = array($arr1,$arr2,..);
How to search through $arr to find the one with key1 => 'something',key2 => 'something else'… Sigue leyendo
Cómo incluir una disposición aleatoria con 2 variable
Mi config.php contiene:
$a1="title";
$b1="text";
$a2="title2";
$b2="text2";
y no tengo 1.php which includes config.php….
I need to include ($a1 and $b1) o ($a and $b) al azar.
¿Cómo puedo hacer esto?
Gracias. Sigue leyendo
How to convert an array into a number in PHP?
I want to convert an array in one large number in PHP.
Por ejemplo, I have an array $array:
$array[0] = 10;
$array[1] = 20;
$array[2] = 30;
$array[3] = 40;
I want this to be:
$one_large_number = 10203040;
…
proper array use in php
It was explained to me by a more senior PHP programmer that using PHP arrays is inefficient as it results in extra data copying. He then explained that you get less memory consumption and more performance by creating classes to… Sigue leyendo
using arrays in where clause as an AND(not OR) operator in dynamic sql
Tengo 5 database tables, in each of which there is a column named UserId and relations are established over that column.
User Mesa (UserId is P.K):
UserId UserName 5 Salamander
Phone Mesa (Id is P.K)
Id UserId …
how to join 2 2D arrays in php?
Tengo 2 2D arrays with exactly same column names. I have to join these 2 arrays.
They are associative arrays i.e; the rows of each array have indices as numbers but each column has got some names as index… Sigue leyendo
Array transformation with PHP
I need to simplify and transform an array like this:
Array
(
[0] => Array
(
[key1] => val1
[key2] => val2
[name] => name_val1
[key3] => val3
[std] => std_val1
)
[1] => Array
(
[key1] => val1
[key2] …
Search for string and output array
Mi código:
$css="
.class1{
padding:10px 15px 0 auto;
padding:10px 150px 0 20px;
padding:13px 30px 10px 50px;
padding:24px 1px 0 -20px;
}
";
Function below extracts content between [relleno:] y [;]
function extract_unit($css, $start, $end){
$pos = stripos($css, $start);
$str = …
Confusión en la actualización de datos de múltiples casillas de verificación
I have a list of checkboxes on a form, which updates the user’s status.
I want to do like, when new users are selected in the checkbox, then they get inserted in DB, de otra manera, if something is unchecked, pero… Sigue leyendo
El uso de matrices de str_replace
Is this valid PHP syntax? I think it may be causing the following warning:
Warning: Illegal offset type
$filterclear = str_replace($tag, '', $queryString);
$filterclear = str_replace(array('=+', '++', '+&'), array('=', '+', '&'), $filterclear);
…





