3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types = 1); // lint >= 8.1 final class Foo implements \Stringable { private function __construct(public readonly string $value) { } public static function fromString(string $string): self { return new self($string); } public function __toString(): string { return $this->value; } } function userlandComparator(string $a, string $b): int { return strnatcasecmp($a, $b); } $options = [ Foo::fromString('c'), Foo::fromString('b'), Foo::fromString('a'), ]; uasort($options, 'userlandComparator'); var_dump($options);
Output for rfc.property-hooks, git.master, git.master_jit
array(3) { [2]=> object(Foo)#3 (1) { ["value"]=> string(1) "a" } [1]=> object(Foo)#2 (1) { ["value"]=> string(1) "b" } [0]=> object(Foo)#1 (1) { ["value"]=> string(1) "c" } }

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:
54.1 ms | 2760 KiB | 4 Q