$stack = [];
// Push elements onto the stack
array_push($stack, "A");
array_push($stack, "B");
array_push($stack, "C");
array_push($stack, "D");
array_push($stack, "E");
// Pop elements from the stack
echo array_pop($stack) . "\n";
echo array_pop($stack) . "\n\n";
// Peek at the top element without removing it
echo end($stack);
echo "\n\n";
print_r($stack);
/*
run:
E
D
C
Array
(
[0] => A
[1] => B
[2] => C
)
*/