3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FormView implements \ArrayAccess { public array $vars = []; public function offsetExists($offset) { return array_key_exists($offset, $this->vars); } public function offsetGet($offset) { return $this->vars[$offset] ?? null; } public function offsetSet($offset, $value) { $this->vars[$offset] = $value; } public function offsetUnset($offset) { unset($this->vars[$offset]); } } $f = new FormView(); $f->offsetSet('as', 1); var_dump($f->offsetExists('as')); var_dump($f->offsetGet('as')); var_dump($f->as); echo "--\n"; $f = new FormView(); $f->as = 123; var_dump($f->offsetExists('as')); var_dump($f->offsetGet('as')); var_dump($f->as); echo "--\n"; $f = new FormView(); $f->offsetSet('as', null); var_dump($f->offsetExists('as')); var_dump($f->offsetGet('as')); var_dump($f->as);
Output for git.master_jit, git.master, rfc.property-hooks
Deprecated: Return type of FormView::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/2uhaE on line 7 Deprecated: Return type of FormView::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/2uhaE on line 10 Deprecated: Return type of FormView::offsetSet($offset, $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/2uhaE on line 13 Deprecated: Return type of FormView::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/2uhaE on line 17 bool(true) int(1) Warning: Undefined property: FormView::$as in /in/2uhaE on line 26 NULL -- Deprecated: Creation of dynamic property FormView::$as is deprecated in /in/2uhaE on line 31 bool(false) NULL int(123) -- bool(true) NULL Warning: Undefined property: FormView::$as in /in/2uhaE on line 42 NULL

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.37 ms | 409 KiB | 5 Q