Tag Archives: tableaux

How to search through subarrays efficiently in PHP?

$arr = array($arr1,$arr2,..);

How to search through $arr to find the one with key1 => 'something',key2 => 'something else'… Continuer la lecture

Tagged , | Laisser un commentaire

Comment inclure un réseau aléatoire avec 2 variables

Ma config.php contient:

$a1="title";
$b1="text";
$a2="title2";
$b2="text2";

and I have 1.php which includes config.php….
I need to include ($a1 and $b1) ou ($a and $b) au hasard.
Comment puis-je faire cela?
Merci. Continuer la lecture

Tagged , , | Laisser un commentaire

How to convert an array into a number in PHP?

I want to convert an array in one large number in PHP.
Par exemple, 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;

Dans Continuer la lecture

Tagged , , , , | Laisser un commentaire

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 toContinuer la lecture

Tagged , , , , | Laisser un commentaire

using arrays in where clause as an AND(not OR) operator in dynamic sql

J'ai 5 database tables, in each of which there is a column named UserId and relations are established over that column.

User Table (UserId is P.K):

UserId UserName
5      Salamander

Phone Table (Id is P.K)

Id UserId

Continuer la lecture

Tagged , , , | Laisser un commentaire

how to join 2 2D arrays in php?

J'ai 2 2D arrays with exactly same column names. I have to join these 2 tableaux.
They are associative arrays i.e; the rows of each array have indices as numbers but each column has got some names as indexContinuer la lecture

Tagged , | Laisser un commentaire

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] 

Continuer la lecture

Tagged , | Laisser un commentaire

Recherche pour la chaîne et le réseau de sortie

Mon code:

    $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 [rembourrage:] et [;]

    function extract_unit($css, $start, $end){
    $pos = stripos($css, $start);
    $str = 

Continuer la lecture

Tagged , , | 1 Comment

Confusion dans la mise à jour des données de plusieurs cases à cocher

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, autrement, if something is unchecked, mais… Continuer la lecture

Tagged , , | Laisser un commentaire

Utilisation des tableaux dans 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);

Continuer la lecture

Tagged , | Laisser un commentaire
64 pages