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);

preferences:
15.39 ms | 459 KiB | 5 Q