3v4l.org

run code in 300+ PHP versions simultaneously
<?php # Typed Properties 2.0 # OLD WAY (PHP < 7.4 ) class User { public $id; public $name; public function __construct(int $id, string $name) { $this->id = $id; $this->name = $name; } } $user = new User(10, []); // This Will throw a Fatal error. # Typed Properties with PHP 7.4 All types are supported, with the exception of void and callable. class NewUser { public int $id; public string $name; } $newUser = new NewUser; $newUser->id = 10; $newUser->name = []; // This Will throw a Fatal error too !!
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: User::__construct(): Argument #2 ($name) must be of type string, array given, called in /in/iFsCM on line 15 and defined in /in/iFsCM:9 Stack trace: #0 /in/iFsCM(15): User->__construct(10, Array) #1 {main} thrown in /in/iFsCM on line 9
Process exited with code 255.

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:
29.02 ms | 406 KiB | 5 Q