3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { protected $private_prop = 'protected_prop'; private $private_prop = 'private_prop'; } $F = new Foo(); $F = serialize($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); var_dump($F);
Output for 5.3.0 - 5.4.29
Fatal error: Cannot redeclare Foo::$private_prop in /in/7bkv7 on line 5
Process exited with code 255.