ahp/stack

PHP 中栈的简单实现。

dev-master 2018-12-31 08:42 UTC

This package is auto-updated.

Last update: 2024-09-29 05:21:28 UTC


README

PHP 中栈的简单实现。

安装

composer require ahp/stack

使用

$stack = new Stack();

// Push an item into the stack
$stack->push($value);

// Pop last item from the stack
$stack->pop();

// Shows the last value at the end of the stack
$stack->peek();

// Validates whether stack is empty.
$stack->isEmpty();

//Merges the given array into stack.
$stack->merge($array)

// Get all of the values inside the stack.
$stack->get();

// Clear stack entirely.
$stack->fresh();