3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FifaRankingHeap extends \SplHeap { protected function compare($value1, $value2) { return $value1['points'] - $value2['points']; }} $heap = new FifaRankingHeap(); $heap->insert(array('country' => 'Colombia', 'points' => 1137)); $heap->insert(array('country' => 'Uruguay', 'points' => 1147)); $heap->insert(array('country' => 'Argentina', 'points' => 1175)); $heap->insert(array('country' => 'Brazil', 'points' => 1242)); $heap->insert(array('country' => 'Portugal', 'points' => 1189)); $heap->insert(array('country' => 'Germany', 'points' => 1300)); $heap->insert(array('country' => 'Switzerland', 'points' => 1149)); $i = 2; foreach ($heap as $country) { echo $i++.$country['country'].' has '.$country['points'].' points.'; }
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of FifaRankingHeap::compare($value1, $value2) should either be compatible with SplHeap::compare(mixed $value1, mixed $value2): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/vckTV on line 4 2Germany has 1300 points.3Brazil has 1242 points.4Portugal has 1189 points.5Argentina has 1175 points.6Switzerland has 1149 points.7Uruguay has 1147 points.8Colombia has 1137 points.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.36 ms | 402 KiB | 8 Q