3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arraykey = new stdClass; $arraykey->date = "2008-05-20"; $arraykey->page_views = 1; $arraykey->date = "2011-08-03"; $arraykey->page_views = 2; $arraykey->date = "2008-08-20"; $arraykey->page_views = 3; $arraykey->date = "2008-08-27"; $arraykey->page_views = 2; $arraykey->date = "2011-10-11"; $arraykey->page_views = 3; var_dump($arraykey); foreach($arraykey as $ad) { echo $ad->date; } echo $total;
Output for 5.0.4 - 5.6.28, 7.0.0 - 7.1.0
object(stdClass)#1 (2) { ["date"]=> string(10) "2011-10-11" ["page_views"]=> int(3) } Notice: Trying to get property of non-object in /in/QWFK8 on line 18 Notice: Trying to get property of non-object in /in/QWFK8 on line 18 Notice: Undefined variable: total in /in/QWFK8 on line 20
Output for hhvm-3.10.0 - 3.12.0
object(stdClass)#1 (2) { ["date"]=> string(10) "2011-10-11" ["page_views"]=> int(3) } Notice: Cannot access property on non-object in /in/QWFK8 on line 18 Notice: Cannot access property on non-object in /in/QWFK8 on line 18 Notice: Undefined variable: total in /in/QWFK8 on line 20
Output for 5.0.0 - 5.0.3
object(stdClass)#1 (2) { ["date"]=> string(10) "2011-10-11" ["page_views"]=> int(3) } Notice: Trying to get property of non-object in /in/QWFK8 on line 18 Notice: Trying to get property of non-object in /in/QWFK8 on line 18 Notice: Undefined variable: total in /in/QWFK8 on line 20
Output for 4.3.0 - 4.4.9
object(stdClass)(2) { ["date"]=> string(10) "2011-10-11" ["page_views"]=> int(3) } Notice: Undefined variable: total in /in/QWFK8 on line 20