array_splice

It removes a portion of the array and replace it with something else

Example

<?php
echo “<pre>”;
$array = array(0 => ‘PHP’, 1 => ‘ASP’, 2 => ‘JSP’, 3 => ‘JS’);
$array1=array_splice($array,3);
print_r($array1);
?>

Output

Array
(
[0] => JS
)

Share