3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $a = 'protected_prop'; private $b = 'private_prop'; function out(){ var_dump($this->a); var_dump($this->b); } } // reading $F = new Foo(); $data = (array)$F; var_dump($data["\0*\0a"]); var_dump($data["\0Foo\0b"]); // writing $F = serialize($F); $F = str_replace('protected_prop','new_protected_prop',$F); $F = str_replace('private_prop','new_private_prop',$F); $F = preg_replace_callback ( '!s:(\d+):"(.*?)";!', function($match) { return ($match[1] == strlen($match[2])) ? $match[0] : 's:' . strlen($match[2]) . ':"' . $match[2] . '";'; },$F ); $F = unserialize($F); $F->out();
Output for git.master, git.master_jit, rfc.property-hooks
string(14) "protected_prop" string(12) "private_prop" string(18) "new_protected_prop" string(16) "new_private_prop"

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