Ds\Stack::push

(PECL ds >= 1.0.0)

Ds\Stack::pushEmpurra valores para a pilha

Descrição

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

Empurra os values para a pilha.

Parâmetros

values

Os valores a serem empurrados para a pilha.

Valor Retornado

Nenhum valor é retornado.

Exemplos

Exemplo #1 Exemplo de Ds\Stack::push()

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

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

print_r($stack);
?>

O exemplo acima produzirá algo semelhante a:

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

User Contributed Notes 1 note

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