3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class MyClass { public $test = ['foo' => 'bar']; }; $my = new MyClass(); $test = var_export(serialize($my), true); $evalString = "<?php return unserialize(" . $test . ");"; file_put_contents($tmpFile, $evalString); var_dump($test);
based on ZdjAv
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0beta1
Notice: Undefined variable: tmpFile in /in/OtNTW on line 10 Warning: file_put_contents(): Filename cannot be empty in /in/OtNTW on line 10 string(57) "'O:7:"MyClass":1:{s:4:"test";a:1:{s:3:"foo";s:3:"bar";}}'"
Output for hhvm-3.15.4
Notice: Undefined variable: tmpFile in /in/OtNTW on line 10 Warning: file_put_contents() expects parameter 1 to be string, null given in /in/OtNTW on line 10 string(57) "'O:7:"MyClass":1:{s:4:"test";a:1:{s:3:"foo";s:3:"bar";}}'"