3v4l.org

run code in 300+ PHP versions simultaneously
<?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) { $temp = 0; if(strtotime($ad->date) > time()) { $temp = $page_views; } $total = $temp + $temp; } echo $total;
Output for 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
object(stdClass)#1 (2) { ["date"]=> string(10) "2011-10-11" ["page_views"]=> int(3) } Notice: Trying to get property 'date' of non-object in /in/6a00a on line 19 Notice: Trying to get property 'date' of non-object in /in/6a00a on line 19 0
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
object(stdClass)#1 (2) { ["date"]=> string(10) "2011-10-11" ["page_views"]=> int(3) } Notice: Trying to get property of non-object in /in/6a00a on line 19 Notice: Trying to get property of non-object in /in/6a00a on line 19 0
Output for 5.0.1 - 5.0.5
object(stdClass)#1 (2) { ["date"]=> string(10) "2011-10-11" ["page_views"]=> int(3) } Notice: Trying to get property of non-object in /in/6a00a on line 19 Warning: strtotime(): Called with an empty time parameter. in /in/6a00a on line 19 Notice: Trying to get property of non-object in /in/6a00a on line 19 Warning: strtotime(): Called with an empty time parameter. in /in/6a00a on line 19 0
Output for 5.0.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/6a00a on line 19 Notice: strtotime(): Called with empty time parameter in /in/6a00a on line 19 Notice: Trying to get property of non-object in /in/6a00a on line 19 Notice: strtotime(): Called with empty time parameter in /in/6a00a on line 19 0
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
object(stdClass)(2) { ["date"]=> string(10) "2011-10-11" ["page_views"]=> int(3) } Notice: strtotime(): Called with empty time parameter in /in/6a00a on line 19 Notice: strtotime(): Called with empty time parameter in /in/6a00a on line 19 0
Output for 4.3.0 - 4.3.1
object(stdClass)(2) { ["date"]=> string(10) "2011-10-11" ["page_views"]=> int(3) } Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/6a00a on line 19 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/6a00a on line 19 0

preferences:
239.35 ms | 402 KiB | 325 Q