PHP SplHeap isEmpty() Function Last Updated : 23 Mar, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The SplHeap::isEmpty() function is an inbuilt function in PHP which is used to check whether the heap is empty or not. Generally, the Heap Data Structure are of two types: Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys present at all of its children. The same property must be recursively true for all sub-trees in that Binary Tree.Min-Heap: In a Min-Heap the key present at the root node must be minimum among the keys present at all of its children. The same property must be recursively true for all sub-trees in that Binary Tree. Syntax: bool SplHeap::isEmpty() Parameters: This function does not accept any parameter. Return Value: This function returns whether the heap is empty. Below programs illustrate the SplHeap::isEmpty() function in PHP: Example 1: PHP <?php // Create a new empty Max Heap $heap1 = new SplMaxHeap(); // Create a new empty Max Heap $heap2 = new SplMaxHeap(); // Insert elements in max heap $heap2->insert('System'); $heap2->insert('GFG'); // Check heap is empty or not var_dump($heap1->isEmpty()); var_dump($heap2->isEmpty()); ?> Output: bool(true) bool(false) Example 2: PHP <?php // Create a new empty Min Heap $heap1 = new SplMinHeap(); // Create a new empty Max Heap $heap2 = new SplMinHeap(); // Insert elements in min heap $heap2->insert('System'); $heap2->insert('GFG'); // Check heap is empty or not var_dump($heap1->isEmpty()); var_dump($heap2->isEmpty()); ?> Output: bool(true) bool(false) Reference: https://www.php.net/manual/en/splheap.isempty.php Comment More infoAdvertise with us Next Article PHP SplHeap next() Function A ashokjaiswal Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP SplHeap insert() Function The SplHeap::insert() function is an inbuilt function in PHP which is used to insert an element in the heap by sifting it up. Generally, the Heap Data Structure are of two types: Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys present at all of its children. 2 min read PHP SplHeap next() Function The SplHeap::next() function is an inbuilt function in PHP that is used to move to the next node. This will delete the top node of the heap. Generally, the Heap Data Structure is of two types. Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys present at all of 2 min read PHP SplHeap isCorrupted() Function The SplHeap::isCorrupted() function is an inbuilt function in PHP which is used to tell if the heap is in a corrupted state. Generally, the Heap Data Structure are of two types: Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys present at all of its children. T 2 min read PHP SplPriorityQueue isEmpty() Function The SplPriorityQueue::isEmpty() function is an inbuilt function in PHP that is used to check whether the queue is empty or not. Syntax: bool SplPriorityQueue::isEmpty() Parameters: This function does not accept any parameter. Return Value: This function returns a boolean value either true or false d 1 min read PHP SplDoublyLinkedList isEmpty() Function The SplDoublyLinkedList::isEmpty() function is an inbuilt function in PHP which is used to check whether the doubly linked list is empty or not. Syntax: bool SplDoublyLinkedList::isEmpty( void ) Parameters: This function does not accepts any parameters. Return Value: This function returns True if do 1 min read PHP SplHeap valid() Function The SplHeap::valid() function is an inbuilt function in PHP which is used to check whether the heap contains more nodes. Generally, the Heap Data Structure are of two types: Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys present at all of its children. The s 2 min read Like