Home  »  CodeGuidesProgrammingSnippetsTechnology   »   PHP Remove Last Element From Array

PHP Remove Last Element From Array

Posted: September 11, 2022 | by Site Host

Use this example PHP remove last element array snippet.

$stack = array("yellow", "red", "green", "blue", "orange");

$removed = array_pop($stack);

print_r($removed);

// Array ($removed) is now:
// "yellow", "red", "green", "blue"

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Share it!

See also  MySQL Repair a Table