3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Foo { private array $data = []; /** @param mixed $value */ public function __set(int $name, $value): void { $this->data[$name] = $value; } public function __isset(int $name): bool { return isset($this->data[$name]); } public function __unset(int $name): void { unset($this->data[$name]); } } $foo = new Foo(); $foo->__set(1, 'one'); $foo->__set(2, 'two'); var_dump( $foo->__isset(1), // true $foo->__isset(2) // true ); $foo->__unset(1); var_dump( $foo->__isset(1) // false );
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Foo::__set(): Parameter #1 ($name) must be of type string when declared in /in/CuTNm on line 8
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:
65.84 ms | 401 KiB | 8 Q