3v4l.org

run code in 300+ PHP versions simultaneously
<?php $template = ['A', 'B', 'C']; $myArray = [ new Element('B'), new Element('C'), new Element('A'), ]; class Element { public $name; public function __construct($name) { $this->name = $name; } } usort($myArray, function($a, $b) use ($template) { return array_search($a, $template) - array_search($b, $template); }); var_dump($myArray);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> object(Element)#1 (1) { ["name"]=> string(1) "B" } [1]=> object(Element)#2 (1) { ["name"]=> string(1) "C" } [2]=> object(Element)#3 (1) { ["name"]=> string(1) "A" } }

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