Syntax:bool SplDoublyLinkedList::isEmpty (void)
Parameters:this function takes no parameters.
Return Value:This function returns True if the doubly linked list is empty, False otherwise.The following programs illustrate
function SplDoublyLinkedList::isEmpty()in PHP:
Program 1:
// Declare an empty SplDoublyLinkedList
$list
=
new
SplDoublyLinkedList;
// Use the isEmpty function
$res
=
$list
-> isEmpty();
var_dump (
$res
);
// Use the SplDoublyLinkedList::push() function for
// add elements to SplDoublyLinkedList
$list
-> push (1);
$list
-> push (2);
$list
-> push (3);
$list
-> push (8);
$list
-> push (5);
// Use the isEmpty function
$res
=
$list
-> isEmpty();
var_dump (
$res
);
?>
Exit:bool (true ) bool (false)
Program 2:
// Declare an empty SplDoublyLinkedList
$list
=
new
SplDoublyLinkedList;
// Use the isEmpty function
$res
=
$list
-> isEmpty();
var_dump (
$res
);
// Use the SplDoublyLinkedList::add() function for
// add elements to SplDoublyLinkedList
$list
-> add (0, 30);
$list
-> add (1, 20);
$list
-> add (2, 30);
$list
-> add (3,
" Geeks "
);
$list
-> add (4,
’ G’
);
// Use the isEmpty function
$res
=
$list
-> isEmpty();
var_dump (
$res
);
?>
Exit:bool (true ) bool (false)
Link: https://www .php.net / manual / en / spldoublylinkedlist.isempty.php