SplDoublyLinkedList::bottom()函数是PHP中的内置函数,用于查看双向链表开头节点的值。
语法:
mixed SplDoublyLinkedList::bottom( void )
参数:它不接受任何参数。
返回值:它返回双向链表中的第一个节点的值。
示例:
<?php
// Declare an empty SplDoublyLinkedList
$list = new \SplDoublyLinkedList;
// Use SplDoublyLinkedList::push() function to
// add elements to the SplDoublyLinkedList
$list->push(1);
$list->push(2);
$list->push(3);
$list->push(8);
$list->push(5);
// Use bottom() function
$val = $list->bottom();
// Display result
print_r($val);
?>
output:
1