3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $a; public $b; public $c; public function __construct($o, $a, $b, $c) { $this->a = $a; $this->b = $b; $this->c = $c; } } $arr = Array( A('a1235d', 'f', 'M'), A('a1235d', 'm', 'L'), A('a1235d', 'm', 'S'), A('a1234d', 'm', 'L'), A('a1234d', 'm', 'S'), A('a1236d', 'm', 'S'), A('a1236d', 'm', 'M'), A('a1234d', 'f', 'S'), A('a1236d', 'f', 'S'), A('a1236d', 'f', 'M'), A('a1235d', 'f', 'S'), A('a1234d', 'm', 'M'), A('a1235d', 'm', 'M'), A('a1234d', 'f', 'M'), A('a1235d', 'f', 'L'), A('a1236d', 'm', 'L'), A('a1236d', 'f', 'L'), A('a1234d', 'f', 'L') ); function sort_by_a($arr) { usort($arr, function($a, $b) { if ($a->a == $b->a) { return 0; } return ($a->a < $b->a) ? -1 : 1; }); return $arr; } function sort_by_b($arr) { usort($arr, function($a, $b) { if ($a->b == $b->b) { return 0; } return ($a->b < $b->b) ? -1 : 1; }); return $arr; } function sort_by_c($arr) { usort($arr, function($a, $b) { if ($a->c == $b->c) { return 0; } return ($a->c < $b->c) ? -1 : 1; }); return $arr; } $arr = sort_by_c($arr); $arr = sort_by_b($arr); $arr = sort_by_a($arr); var_dump($arr);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function A() in /in/Gn8Jr:15 Stack trace: #0 {main} thrown in /in/Gn8Jr on line 15
Process exited with code 255.

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:
67.2 ms | 401 KiB | 8 Q