3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $export = array(); $view = new stdClass(); $view->name = 'first_view'; $view->value = 'first_view_value'; $export[$view->name] = clone $view; $view->value = 'messing around with the view after the fact'; $view = new stdClass(); $view->name = 'second_view'; $view->value = 'second_view_value'; $export[$view->name] = clone $view; $view->value = 'messing around with the view after the fact part 2'; var_dump($export);
based on pKTdk
Output for 5.0.0 - 7.2.0
array(2) { ["first_view"]=> object(stdClass)#2 (2) { ["name"]=> string(10) "first_view" ["value"]=> string(16) "first_view_value" } ["second_view"]=> object(stdClass)#1 (2) { ["name"]=> string(11) "second_view" ["value"]=> string(17) "second_view_value" } }
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/I6gLo on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_VARIABLE in /in/I6gLo on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/I6gLo on line 9
Process exited with code 255.