3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($test) { return new class($test) { public function __construct(public $test) {} }; } function test3($test) { return eval("return new class($test) { public function __construct(public \$test) {}};" ); } function compare($a, $b) { var_dump([ $a == $b, $a === $b, get_class($a) == get_class($b), ]); } compare(test(1), test(1)); // true, false, true, compare(test3(1), test3(1)); // false, false, false,

preferences:
35.92 ms | 404 KiB | 5 Q