3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __construct() { $this->fp = fopen(__FILE__, 'r'); } public function __destruct() { fclose($this->fp); } public function __clone() { $this->fp = fopen(__FILE__, 'r'); } public function getFp() { return $this->fp; } } $t = new Test; var_dump($t->getFp()); // works $c = clone $t; var_dump($c->getFp()); // works var_dump((clone $t)->getFp()); // dtor'd before being accessed?
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property Test::$fp is deprecated in /in/jQ0Pi on line 7 resource(5) of type (stream) resource(6) of type (stream) resource(7) of type (Unknown)

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:
109.29 ms | 1517 KiB | 4 Q