<?php
$arr = ['a', 'b', 'c', 'd'];
$arr2 = [1 => 'f', 2 => 'c'];
print_r($arr[1,2]); //1 => 'b', 2 => 'c'
print_r($arr[1..3]); //1 => 'b', 2 => 'c', 3 => 'd' аналогично array_slice()
print_r($arr - $arr2); //0 => 'a', 3 => 'd' аналогично array_diff_key()
$arr = ['a', 'b', 'c', 'd'];
print_r(array_slice($arr, 1, 3));
Array
(
[0] => b
[1] => c
[2] => d
)
// print_r($arr[1,2]); //1 => 'b', 2 => 'c'
$arr = ['a', 'b', 'c', 'd'];
$arr2 = [1 => 'f', 2 => 'c'];
print_r(array_combine(
array_keys($arr2),
array_slice($arr, 1, 2)
));