What are the differences between using a custom heap class and PHP's internal SPLHeap class in A* Pathfinding implementation in PHP?

When implementing A* Pathfinding in PHP, using a custom heap class allows for more control and customization over the priority queue data structure, while PHP's internal SPLHeap class provides a built-in solution that may be easier to use but less flexible. Depending on the specific requirements of the A* algorithm and the project, either option can be suitable.

// Using a custom heap class for A* Pathfinding implementation
class CustomHeap extends SplMinHeap {
    public function compare($a, $b) {
        return $a <=> $b;
    }
}

$heap = new CustomHeap();
$heap->insert(5);
$heap->insert(3);
$heap->insert(8);

while (!$heap->isEmpty()) {
    echo $heap->extract() . "\n";
}