3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); // lint >= 8.1 namespace Bug11619Strict; 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 test(): void { $options = [ Foo::fromString('c'), Foo::fromString('b'), Foo::fromString('a'), ]; uasort($options, 'strnatcasecmp'); usort($options, 'strnatcasecmp'); } test();
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3

preferences:
48.24 ms | 696 KiB | 4 Q