略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Ds\Stack::push

2024-04-29

Ds\Stack::push

(PECL ds >= 1.0.0)

Ds\Stack::pushPushes values onto the stack

说明

public Ds\Stack::push(mixed ...$values): void

Pushes values onto the stack.

参数

values

The values to push onto the stack.

返回值

没有返回值。

范例

示例 #1 Ds\Stack::push() example

<?php
$stack 
= new \Ds\Stack();

$stack->push("a");
$stack->push("b");
$stack->push("c""d");
$stack->push(...["e""f"]);

print_r($stack);
?>

以上例程的输出类似于:

Ds\Stack Object
(
    [0] => a
    [1] => b
    [2] => c
    [3] => d
    [4] => e
    [5] => f
)
add a noteadd a note

User Contributed Notes 1 note

up
-9
ishaankesari7 at gmail dot com
5 years ago
If  "f " is put at the  last so it should be on the top of the stack not at the bottom.

官方地址:https://www.php.net/manual/en/ds-stack.push.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3