3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Box{ protected $type, $ref; function __construct($type, &$var){ $this->type = $type; $this->ref = &$var; } function __set($name, $data){ $this->ref = [$this->type, "__box"]($data); } } function §($type, &$var){ return new Box($type, $var); } // --------- class UString{ function __construct($data){ $this->data = $data; } static function __box($data){ if(is_string($data)) return new static($data); throw new Error; } } const UString = UString::CLASS; // --------- §(UString, $bar)->set = "ùnìcòdè"; var_dump($bar);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property UString::$data is deprecated in /in/TIjI8 on line 22 object(UString)#2 (1) { ["data"]=> string(11) "ùnìcòdè" }

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:
46.41 ms | 401 KiB | 8 Q