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) { return array_search($a) - array_search($b); }); var_dump($myArray);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: array_search() expects at least 2 arguments, 1 given in /in/UvEk3:22 Stack trace: #0 /in/UvEk3(22): array_search(Object(Element)) #1 [internal function]: {closure}(Object(Element), Object(Element)) #2 /in/UvEk3(21): usort(Array, Object(Closure)) #3 {main} thrown in /in/UvEk3 on line 22
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:
58.59 ms | 401 KiB | 8 Q