array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'ds-stack.construct.php', 1 => 'Ds\\Stack::__construct', ), 'up' => array ( 0 => 'class.ds-stack.php', 1 => 'Ds\\Stack', ), 'prev' => array ( 0 => 'ds-stack.clear.php', 1 => 'Ds\\Stack::clear', ), 'next' => array ( 0 => 'ds-stack.copy.php', 1 => 'Ds\\Stack::copy', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/stack/construct.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL ds >= 1.0.0)
Ds\Stack::__construct — Creates a new instance
Creates a new instance, using either a traversable
object or an Array for the initial values
.
values
A traversable object or an Array to use for the initial values.
Beispiel #1 Ds\Stack::__construct() example
<?php
$stack = new \Ds\Stack();
print_r($stack);
$stack = new \Ds\Stack([1, 2, 3]);
print_r($stack);
?>
Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
Ds\Stack Object ( ) Ds\Stack Object ( [0] => 3 [1] => 2 [2] => 1 )