(PECL ds >= 1.0.0)
Ds\Stack::peek — 傳回堆疊頂部的值
此函式沒有參數。
堆疊頂部的值。
如果堆疊為空,則拋出 UnderflowException。
範例 #1 Ds\Stack::peek() 範例
<?php
$stack = new \Ds\Stack();
$stack->push("a");
$stack->push("b");
$stack->push("c");
var_dump($stack->peek());
?>
以上範例的輸出結果類似於
string(1) "c"