PHP - Funzione Ds Deque push ()
La funzione Ds \ Deque :: push () può aggiungere valori alla fine della deque.
Sintassi
public void Ds\Deque::push([ mixed $...values ] )
La funzione Ds \ Deque :: push () non restituisce alcun valore.
Esempio 1
<?php
$deque = new \Ds\Deque([10, 20, 30, 40, 50]);
echo("The elements in deque: \n");
print_r($deque);
echo("\n Add number 100 in deque: \n");
$deque->push(100);
echo("\n The elements in deque: \n");
print_r($deque);
?>
Esempio 2
<?php
$deque = new \Ds\Deque([10, 20, 30, 40, 50]);
echo("The elements in deque: \n");
print_r($deque);
echo("\n Adding elements in deque: \n");
$deque->push(...[60, 70, 80, 90]);
echo("\n The elements in deque: \n");
print_r($deque);
?>