3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $mVars; public function generateVars() { $this->mVars = [ 'x', 'y', 'z' ]; } public function dumpVars() { var_dump( $this->mVars ); } } // 1. Make mVars public, uncomment line 16, then eval. $before = new Foo(); $before->generateVars(); // echo serialize($before) . "\n"; define('BEFORE', 1); // 2. Insert the serialised text from first eval $serialised = 'O:3:"Foo":1:{s:5:"mVars";a:3:{i:0;s:1:"x";i:1;s:1:"y";i:2;s:1:"z";}}'; // 3. Make mVars private, comment out line 16, then eval $after = unserialize($serialised); $after->dumpVars();
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> string(1) "x" [1]=> string(1) "y" [2]=> string(1) "z" }

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