3v4l.org

run code in 500+ PHP versions simultaneously
<?php class base implements ArrayAccess { public function offsetSet($propertyName, $value) { $this->$propertyName = $value; } public function offsetExists($propertyName) { return isset($this->$propertyName); } public function offsetUnset($propertyName) { unset($this->$propertyName); } public function offsetGet($propertyName) { return isset($this->$propertyName) ? $this->$propertyName : null; } } class User extends base { public $foreName; public $familyName; public function __construct($forename, $familyname) { $this->foreName = $forename; $this->familyName = $familyname; } } $data = new User('Mark', 'Baker'); echo $data['foreName'], PHP_EOL; $data['foreName'] = 'SuperMark'; echo $data['foreName'], PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of base::offsetExists($propertyName) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/MajRB on line 8 Deprecated: Return type of base::offsetGet($propertyName) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/MajRB on line 16 Deprecated: Return type of base::offsetSet($propertyName, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/MajRB on line 4 Deprecated: Return type of base::offsetUnset($propertyName) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/MajRB on line 12 Mark SuperMark

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:
56.17 ms | 2091 KiB | 4 Q