3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array(); $object = (object) [ 'title' => '', ]; $object->{title} = 'wootcakes'; array_push($arr, $object); $object = (object) [ 'title' => '', ]; $object->{title} = 'foobars'; array_push($arr, $object); $object = (object) [ 'title' => '', ]; $object->{title} = 'lulmeightz'; array_push($arr, $object); var_dump($arr);
based on EsjLG
Output for 7.2.0 - 7.3.0
Warning: Use of undefined constant title - assumed 'title' (this will throw an Error in a future version of PHP) in /in/2fqvk on line 7 Warning: Use of undefined constant title - assumed 'title' (this will throw an Error in a future version of PHP) in /in/2fqvk on line 14 Warning: Use of undefined constant title - assumed 'title' (this will throw an Error in a future version of PHP) in /in/2fqvk on line 21 array(3) { [0]=> object(stdClass)#1 (1) { ["title"]=> string(9) "wootcakes" } [1]=> object(stdClass)#2 (1) { ["title"]=> string(7) "foobars" } [2]=> object(stdClass)#3 (1) { ["title"]=> string(10) "lulmeightz" } }
Output for 5.6.38 - 7.1.25
Notice: Use of undefined constant title - assumed 'title' in /in/2fqvk on line 7 Notice: Use of undefined constant title - assumed 'title' in /in/2fqvk on line 14 Notice: Use of undefined constant title - assumed 'title' in /in/2fqvk on line 21 array(3) { [0]=> object(stdClass)#1 (1) { ["title"]=> string(9) "wootcakes" } [1]=> object(stdClass)#2 (1) { ["title"]=> string(7) "foobars" } [2]=> object(stdClass)#3 (1) { ["title"]=> string(10) "lulmeightz" } }