Массивы и коллекции / Словари

<?php

//In PHP there are no
//Dictionary type, use array instead

$d1 = [1 => "one"];
$d2 = [2 => "two"];
$d3 = [3 => "three"];

$dAll1 = array_merge($d1, $d2, $d3);
//dAll1 is [[1, "one"], [2, "two"], [3, "three"]]

$dAll2 = [1 => "one", ...$d2, ...$d3];
//dAll2 is [[1, "one"], [2, "two"], [3, "three"]]

$s1 = ["A" => 1];
$s2 = ["B" => 2];

$sAll = ["A" => 0, ...$s1, ...$s2];
//sAll is [["A", 1], ["B", 2]]

print_r($dAll1);
print_r($dAll2);
print_r($sAll);