3v4l.org

run code in 500+ PHP versions simultaneously
<?php final class Foo implements \Stringable { private function __construct(public readonly string $value) { } public static function fromString(string $string): self { return new self($string); } /** * {@inheritdoc} */ public function __toString(): string { return $this->value; } } $options = [ Foo::fromString('c'), Foo::fromString('b'), Foo::fromString('a'), Foo::fromString('ccc'), Foo::fromString('bcc'), ]; var_dump(strnatcasecmp($options[1], $options[2])); uasort($options, 'strnatcasecmp'); var_export($options);
Output for git.master_jit
int(1) array ( 2 => \Foo::__set_state(array( 'value' => 'a', )), 1 => \Foo::__set_state(array( 'value' => 'b', )), 4 => \Foo::__set_state(array( 'value' => 'bcc', )), 0 => \Foo::__set_state(array( 'value' => 'c', )), 3 => \Foo::__set_state(array( 'value' => 'ccc', )), )
Output for git.master

Process exited with code 139.

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.08 ms | 502 KiB | 4 Q