3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public $username; public $binders; function __construct($username, $binders) { $this->username = $username; $this->binders = $binders; } } class Binder { public $name; public $contents; function __construct($name, $contents = array()) { $this->name = $name; $this->contents = $contents; } } class Card { public $id; public $quantity; function __construct($id, $quantity = 0) { $this->id = $id; $this->quantity = $quantity; } } $users = array ( 'TestName' => new User ( 'TestName', array ( 'BinderName1' => new Binder ( 'BinderName1', array ( 'CardID_1' => new Card('1', '20'), 'CardID_3' => new Card('3', '10'), ) ), 'BinderName2' => new Binder ( 'BinderName2', array ( 'CardID_1' => new Card('1', '7') ) ) ) ) ); print_r($users); $users['TestName']->binders['BinderName1']->contents['CardID_1']->quantity = 5; print_r($users);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [TestName] => User Object ( [username] => TestName [binders] => Array ( [BinderName1] => Binder Object ( [name] => BinderName1 [contents] => Array ( [CardID_1] => Card Object ( [id] => 1 [quantity] => 20 ) [CardID_3] => Card Object ( [id] => 3 [quantity] => 10 ) ) ) [BinderName2] => Binder Object ( [name] => BinderName2 [contents] => Array ( [CardID_1] => Card Object ( [id] => 1 [quantity] => 7 ) ) ) ) ) ) Array ( [TestName] => User Object ( [username] => TestName [binders] => Array ( [BinderName1] => Binder Object ( [name] => BinderName1 [contents] => Array ( [CardID_1] => Card Object ( [id] => 1 [quantity] => 5 ) [CardID_3] => Card Object ( [id] => 3 [quantity] => 10 ) ) ) [BinderName2] => Binder Object ( [name] => BinderName2 [contents] => Array ( [CardID_1] => Card Object ( [id] => 1 [quantity] => 7 ) ) ) ) ) )

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:
62.35 ms | 409 KiB | 8 Q