array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'ds-stack.clear.php', 1 => 'Ds\\Stack::clear', ), 'up' => array ( 0 => 'class.ds-stack.php', 1 => 'Ds\\Stack', ), 'prev' => array ( 0 => 'ds-stack.capacity.php', 1 => 'Ds\\Stack::capacity', ), 'next' => array ( 0 => 'ds-stack.construct.php', 1 => 'Ds\\Stack::__construct', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/stack/clear.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL ds >= 1.0.0)
Ds\Stack::clear — Removes all values
此函数没有参数。
没有返回值。
示例 #1 Ds\Stack::clear() example
<?php
$stack = new \Ds\Stack([1, 2, 3]);
print_r($stack);
$stack->clear();
print_r($stack);
?>
以上示例的输出类似于:
Ds\Stack Object ( [0] => 3 [1] => 2 [2] => 1 ) Ds\Stack Object ( )