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.