承接 cancio-labs/php-stack 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cancio-labs/php-stack

最新稳定版本:v1.2.1

Composer 安装命令:

composer require cancio-labs/php-stack

包简介

Interface and an array-based implementation of the LIFO Stack data structure.

README 文档

README

This tiny package contains an interface and an array-based implementation of the LIFO Stack data structure.

Interface

Method Description
push Adds a new element to the top of the stack.
pop Removes and return the top element of the stack.
top Returns the top element of the stack.
isEmpty Tests whether the stack is empty.
clear Removes all elements from the stack.
count Returns the number of elements of the stack.
toArray Transforms the stack into an array.

How to use it

$stack = new Stack(['A', 'B']);

$stack->push('C');
$stack->push('D');

$stack->isEmpty(); // returns false
$stack->count(); // returns 4

$stack->top(); // output 'D'
$stack->pop(); // returns 'D'

$array = $stack->toArray(); // return ['A', 'B', 'C']

foreach ($stack as $element) {
    // i=0: $element = 'C'
    // i=1: $element = 'B'
    // i=2: $element = 'A'
}

$stack->isEmpty(); // returns true 

Tests and Coverage

All tests are passing with no warnings and code coverage is 100%.

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2024-02-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固