php教程

SplDoublyLinkedList::isEmpty

(PHP 5 >= 5.3.0, PHP 7)

SplDoublyLinkedList::isEmptyChecks whether the doubly linked list is empty

说明

public SplDoublyLinkedList::isEmpty ( void ) : bool

参数

此函数没有参数。

返回值

Returns whether the doubly linked list is empty.

User Contributed Notes

lincoln dot du dot j at gmail dot com 10-Jul-2017 07:53
//isEmpty is a method of SplDoublyLinkedList

$obj = new SplDoublyLinkedList();
// Check wither linked list is empty
if ($obj->isEmpty())
{
    $obj->push(2);
    $obj->unshift(10);
}
print_r($obj);

//Output like this
SplDoublyLinkedList Object
(
    [flags:SplDoublyLinkedList:private] => 0
    [dllist:SplDoublyLinkedList:private] => Array
        (
            [0] => 10
            [1] => 2
        )

)

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788