d
Amit DhamuSoftware Engineer
 

Remove Value From Array

1 minute read 00000 views
// The Array
$array = ['Orange', 'Lemon', 'Banana', 'Grapes', 'Tomato', 'Kiwi'];

// Let's remove Banana, Tomato and Kiwi
$array = array_diff($array, ['Banana', 'Tomato', 'Kiwi']);

// Updated Array Looks Like
Array
(
    [0] => Orange
    [1] => Lemon
    [2] => Grapes
)