Answer the question
In order to leave comments, you need to log in
What are the constructs/operators that work with arrays in PHP?
I wonder if such constructions are possible:
<?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()
Answer the question
In order to leave comments, you need to log in
There are no structures, there are functions.
$arr = ['a', 'b', 'c', 'd'];
print_r(array_slice($arr, 1, 3));
Array
(
[0] => b
[1] => c
[2] => d
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question