“tableau plat PHP” Réponses codées

tableau plat PHP

$c = ["a" => ["x" => "X", "y" => "Y"], "b" => ["p" => "P", "q" => "Q"]];
print_r(array_merge(...array_values($c)));

Array
(
    [x] => X
    [y] => Y
    [p] => P
    [q] => Q
)
Defeated Dunlin

tableau d'aplatissement PHP

array_merge(...$a);
Indian Gooner

tableau plat PHP

$a = [[10, 20], [30, 40]];
$b = [["x" => "X", "y" => "Y"], ["p" => "P", "q" => "Q"]];

print_r(array_merge(...$a));
print_r(array_merge(...$b));

Array
(
    [0] => 10
    [1] => 20
    [2] => 30
    [3] => 40
)
Array
(
    [x] => X
    [y] => Y
    [p] => P
    [q] => Q
)
Defeated Dunlin

Réponses similaires à “tableau plat PHP”

Questions similaires à “tableau plat PHP”

Plus de réponses similaires à “tableau plat PHP” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code