Difference between array_slice() and array_splice() in php
array_splice() is used to remove some elements from an array and replace with specified elements.
array_slice() is used to extract a selected parts of an array .

array_slice() Function in PHP:

array_slice() is used to extract a selected parts of an array .

array_slice() Example:
<?php
$numbers = array("1", "2", "3", "4", "5");
$new_numbers = array_slice($numbers, 2);      
$new_numbers = array_slice($numbers, -3, 1);  
?>
Output:
Array
(
    [0] => 3
    [1] => 4
    [2] => 5
)
Array
(
    [0] => 3
    
)

array_splice() Function in PHP:

array_splice() is used to remove some elements from an array and replace with specified elements.

array_splice() Example:
<?php
$numbers = array("1", "2", "3", "4", "5");
$new_numbers = array_splice($numbers, 2);      
$new_numbers = array_splice($numbers, -3, 1,"8");  


?>
Output:
Array
(
    [0] => 1
    [1] => 2
    
)
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 8
)