PHP SplHeap extract() Function Last Updated : 23 Mar, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The SplHeap::extract() function is an inbuilt function in PHP which is used to extract a node from top of the heap and sift 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. 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: mixed SplHeap::extract() Parameters: This function does not accept any parameter. Return Value: This function returns the value of the extracted node. Below programs illustrate the SplHeap::extract() function in PHP: Example 1: PHP <?php // Create a new empty Min Heap $heap = new SplMinHeap(); $heap->insert('System'); $heap->insert('GFG'); $heap->insert('ALGO'); $heap->insert('C'); $heap->insert('Geeks'); $heap->insert('GeeksforGeeks'); echo $heap->extract(); ?> Output: ALGO Example 2: PHP <?php // Create a new empty Max Heap $heap = new SplMaxHeap(); $heap->insert('System'); $heap->insert('GFG'); $heap->insert('ALGO'); $heap->insert('C'); $heap->insert('Geeks'); $heap->insert('GeeksforGeeks'); echo $heap->extract(); ?> Output: System Reference: https://www.php.net/manual/en/splheap.extract.php Comment More infoAdvertise with us Next Article PHP | SplHeap current() Function A ashokjaiswal Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP SplHeap __construct() Function The SplHeap::__construct() function is an inbuilt function in PHP that is used to create the heap data structure. 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 pr 2 min read PHP | SplHeap count() Function The SplHeap::count() function is an inbuilt function in PHP which is used to count the elements in the heap. Generally, Heap can be 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 recursi 2 min read PHP extract() Function The extract() Function is an inbuilt function in PHP. The extract() function does array to variable conversion. That is it converts array keys into variable names and array values into variable value. In other words, we can say that the extract() function imports variables from an array to the symbo 3 min read PHP | SplHeap current() Function The SplHeap::current() function is an inbuilt function in PHP which is used to get the current element pointed by the iterator. 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 ZipArchive extractTo() Function The ZipArchive::extractTo() function is an inbuilt function in PHP that is used to extract the zip archive content in a folder.Syntax:bool ZipArchive::extractTo( string $pathto, array|string|null $files = null)Parameters: This function accepts two parameters that are described below:$pathto: This pa 2 min read PHP SplPriorityQueue extract() Function The SplPriorityQueue::extract() function is an inbuilt function in PHP which is used to extract a node from top of the heap and sift up. Syntax: mixed SplPriorityQueue::extract() Parameters: This function does not accept any parameter. Return Value: This function returns the value/priority (or both) 1 min read Like