略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SplDoublyLinkedList::isEmpty

2024-11-15

SplDoublyLinkedList::isEmpty

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

SplDoublyLinkedList::isEmptyChecks whether the doubly linked list is empty

说明

public SplDoublyLinkedList::isEmpty(): bool

参数

此函数没有参数。

返回值

Returns whether the doubly linked list is empty.

add a noteadd a note

User Contributed Notes 1 note

up
0
lincoln dot du dot j at gmail dot com
4 years ago
//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
        )

)

官方地址:https://www.php.net/manual/en/spldoublylinkedlist.isempty.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3