3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); namespace App; spl_autoload_register(function (string $name): void { printf("autoload: %s\n", $name); }); use stdClass; use Lib\Bar; final class Foo { public C1 $c1; public function method(C2 $c2) {} } $foo = new Foo(); try { $foo->c1 = new stdClass(); } catch (\Throwable $e) { // TypeError にはなるがオートローダは実行されない var_dump($e->getMessage()); } try { $foo->method(new stdClass()); } catch (\Throwable $e) { // TypeError にはなるがオートローダは実行されない var_dump($e->getMessage()); } var_dump(C3::class); var_dump($foo instanceOf C4);
Output for git.master, git.master_jit, rfc.property-hooks
string(62) "Cannot assign stdClass to property App\Foo::$c1 of type App\C1" string(107) "App\Foo::method(): Argument #1 ($c2) must be of type App\C2, stdClass given, called in /in/MtoWM on line 28" string(6) "App\C3" bool(false)

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:
27.5 ms | 401 KiB | 8 Q