3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public $Username; public $Password; public $Inbox; private function __construct($Username, $Password) { $this->$Username = $Username; $this->$Password = $Password; $this->$Inbox = new Inbox($Username); } public static function Login($Username, $Password) { return new User($Username, $Password); } } class Inbox { public $Messages; public function __construct($Username) { $Messages = array(); $Messages[] = "Message 1"; $Messages[] = "Message 2"; } } $theUser = User::Login("Poopy", "Butt"); echo $theUser->Username; echo $theUser->Password; echo $theUser->$Username; echo $theUser->$Password; print_r($theUser->Messages); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property User::$Poopy is deprecated in /in/7mLg0 on line 10 Deprecated: Creation of dynamic property User::$Butt is deprecated in /in/7mLg0 on line 11 Warning: Undefined variable $Inbox in /in/7mLg0 on line 12 Deprecated: Creation of dynamic property User::$ is deprecated in /in/7mLg0 on line 12 Warning: Undefined variable $Username in /in/7mLg0 on line 34 Fatal error: Uncaught Error: Object of class Inbox could not be converted to string in /in/7mLg0:34 Stack trace: #0 {main} thrown in /in/7mLg0 on line 34
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.45 ms | 402 KiB | 8 Q