remove number of elements from array php

    By: Manu
    3 years ago

    We can remove number of array element using php function "array_splice".

    $words = [
           0 => "amazing", 
           1 => "bad", 
           2 => "cute"
    ];
    array_splice($words, 1, 1); // remove one element from index 1
    

    So it can be like this

    array_splice($array, $offset_you_want_to_delete, $number_of_elements_to_remove)