3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = [(new stdClass)->text = "ans1", (new stdClass)->text="ans2", (new stdClass)->text="ans3"]; var_dump($arr); //$nu = [arr[0].text,arr[1].text,arr[2].text]; //var_dump($nu);
Output for 7.0.0 - 7.1.7
Fatal error: Cannot use temporary expression in write context in /in/Qj9ss on line 3
Process exited with code 255.
Output for hhvm-3.15.4
array(3) { [0]=> string(4) "ans1" [1]=> string(4) "ans2" [2]=> string(4) "ans3" }
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '=', expecting ']' in /in/Qj9ss on line 3
Process exited with code 255.