3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compare($a, $b) { // Sort by weight, unless disabled. if ($a->region != -1) { $weight = $a->weight - $b->weight; if ($weight) { return $weight; } } // Sort by label. return strcmp($a->label, $b->label); } $a = (object)['region' => 1, 'weight' => 1, 'label' => 'A']; $b = (object)['region' => -1, 'weight' => 2, 'label' => 'A']; $c = (object)['region' => 1, 'weight' => 0, 'label' => 'B']; assert(-1 === compare($a, $b)); assert(-1 === compare($b, $c)); assert(-1 === compare($c, $a));
Output for git.master, git.master_jit, rfc.property-hooks

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:
156.45 ms | 405 KiB | 5 Q