Splicing Arrays in PHP
Given an array:
<?php
$arr = [1, 2, 3, 4, 5];
?>
Cut elements from it, so that the array becomes like this:
<?php
[1, 4, 5]
?>
Given an array:
<?php
$arr = [1, 2, 3, 4, 5];
?>
Get the following slice from this array:
<?php
[2, 3, 4]
?>
Given an array:
<?php
$arr = [1, 2, 3, 4, 5];
?>
Add new elements to this array:
<?php
[1, 2, 3, 'a', 'b', 'c', 4, 5]
?>
Given an array:
<?php
$arr = [1, 2, 3, 4, 5];
?>
Add new elements to this array:
<?php
[1, 'a', 'b', 2, 3, 4, 'c', 5, 'e']
?>