3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { public $property; public function __construct($property) { $this->property = $property; } } // $obj1 = new MyClass('value'); $obj2 = new MyClass('value'); echo match ($obj1 = new MyClass('value')) { $obj2 => 2, null => 3, $obj1 => 1, };
Output for 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.16, 8.4.1 - 8.4.2
1

preferences:
63.46 ms | 406 KiB | 5 Q