Removing Elements from an Array Using array_splice() in PHP


Remove elements from an array and possibly replace them.

Source Code

$input = array("red", "green", "blue", "yellow");
array_splice($input, 2);
// $input is now array("red", "green")
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments