Ds\Stack::__construct
PHP function
Edit on GitHub ✎
(PECL ds >= 1.0.0)
Creates a new instance
Description
Ds\Stack::__construct([mixed $values])
Creates a new instance, using either a traversable object or an Array for the initial values.
Parameters
valuesA traversable object or an Array to use for the initial values.
Examples
Ds\Stack::__construct() example
php
<?php
$stack = new \Ds\Stack();
print_r($stack);
$stack = new \Ds\Stack([1, 2, 3]);
print_r($stack);
?>The above example will output something similar to:
output
Ds\Stack Object
(
)
Ds\Stack Object
(
[0] => 3
[1] => 2
[2] => 1
)