PHP SplHeap isEmpty() Function Last Updated : 23 Mar, 2021 Comments Improve Suggest changes 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 Create Quiz Comment A ashokjaiswal Follow 0 Improve A ashokjaiswal Follow 0 Improve Article Tags : Web Technologies PHP PHP-function Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like