Skip to content

PHP code snippet – How to remove first element in array ?

<?php
$stack = array("orange", "banana", "apple", "raspberry");
$fruit = array_shift($stack);
print_r($stack);
?>


// Array
// (
//     [0] => banana
//     [1] => apple
//     [2] => raspberry
// )
See also  How to remove arrays in Python from a specific place?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.