How to deleting a single array element php

    By: Manu
    3 years ago

    Let's see this array

    $array = [
          0 => "apple", 
          1 => "banana", 
          2 => "chocolate"
    ];
    

    We can use php function unset

    unset($array[1]);  // will remove Banana from array
    

    It will return

    [
        [0] => "apple"
        [2] => "chocolate"
    ]