3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class User{ public $username; public $email; private $parse = 'phpinfo'; public $canonicalname; function __construct($username,$email){ $this->username = $username; $this->email = $email; //check username $parse = $this->parse; $this->canonicalname = $parse(); } public function __wakeup() { //make sure object is safe to use $parse = $this->parse; $this->canonicalname = $parse(); } } $user = new User('hugo', 'email'); var_dump(serialize($user));
Output for 5.3.0 - 7.2.0
Warning: phpinfo() has been disabled for security reasons in /in/r9QiM on line 13 string(121) "O:4:"User":4:{s:8:"username";s:4:"hugo";s:5:"email";s:5:"email";s:11:"Userparse";s:7:"phpinfo";s:13:"canonicalname";N;}"