3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public string $name = ""; public string $password = ""; public int $admin = 0; public string $fullName = ""; public function __construct(string $name, string $password, int $admin) { $this->name = $name; $this->password= $password; $this->admin = $admin; } public function __wakeup() { $this->fullName = $this->name . $this->password; } } $user_test = new User("Sebastian", "Password", 1); var_dump($user_test); var_dump(serialize($user_test)); $other_user = unserialize('O:4:"User":3:{s:4:"name";s:9:"Sebastian";s:8:"password";s:8:"Password";s:5:"admin";i:2;}'); var_dump($other_user);
Output for git.master, git.master_jit, rfc.literals, rfc.partials
object(User)#1 (4) { ["name"]=> string(9) "Sebastian" ["password"]=> string(8) "Password" ["admin"]=> int(1) ["fullName"]=> string(0) "" } string(110) "O:4:"User":4:{s:4:"name";s:9:"Sebastian";s:8:"password";s:8:"Password";s:5:"admin";i:1;s:8:"fullName";s:0:"";}" object(User)#2 (4) { ["name"]=> string(9) "Sebastian" ["password"]=> string(8) "Password" ["admin"]=> int(2) ["fullName"]=> string(17) "SebastianPassword" }

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:
14.99 ms | 459 KiB | 5 Q