1--TEST-- 2SPL: SplHeap with overridden compare() 3--FILE-- 4<?php 5class SplMinHeap2 extends SplMinHeap { 6 public function compare($a, $b) { 7 return -parent::compare($a,$b); 8 } 9} 10$h = new SplMinHeap2(); 11$h->insert(1); 12$h->insert(6); 13$h->insert(5); 14$h->insert(2); 15var_dump($h->top()); 16 17class SplMaxHeap2 extends SplMaxHeap { 18 public function compare($a, $b) { 19 return -parent::compare($a,$b); 20 } 21} 22$h = new SplMaxHeap2(); 23$h->insert(1); 24$h->insert(6); 25$h->insert(5); 26$h->insert(2); 27var_dump($h->top()); 28?> 29--EXPECT-- 30int(6) 31int(1) 32