使用: for($i=1; $i<= 10000; ++$i) { $arrayOfNumbers[] = rand(1, 99999); } 有人可以解释为什么有这样的速度差异: array_map(array($maxHeap, 'insert'), $arrayOfNumbers); # Avg Time: 0.92856907844543s # against foreach($arrayOfNumbers as $number) { $maxHeap->insert($number); } # Avg Time: 1.3148670101166 $maxHeap是一个对象class MaxHeap extends SplMaxHeap