3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $content = '{"data":[{"contactid":"21405","startdate":"2016-01-25 00:00:00","workingdays":"1.00","staff_email":"lee@unu.edu","staff_department":"Procurement & Administration Unit - KL","staff_name":"Angela LEE","enddate":"2016-01-25 00:00:00"},{"contactid":"21405","startdate":"2016-02-01 00:00:00","workingdays":"1.00","staff_email":"lee@unu.edu","staff_department":"Procurement & Administration Unit - KL","staff_name":"Angela LEE","enddate":"2016-02-01 00:00:00"}]} '; $json = json_decode($content); print_r($json); $dates = ""; //$away_dates = ''; for ($i=0; $i< array_count($json); $i++) { $dates .= $json->data[$i]->startdate. ", "; } echo $dates;
based on XdJIN
Output for 7.0.0 - 7.2.0
stdClass Object ( [data] => Array ( [0] => stdClass Object ( [contactid] => 21405 [startdate] => 2016-01-25 00:00:00 [workingdays] => 1.00 [staff_email] => lee@unu.edu [staff_department] => Procurement & Administration Unit - KL [staff_name] => Angela LEE [enddate] => 2016-01-25 00:00:00 ) [1] => stdClass Object ( [contactid] => 21405 [startdate] => 2016-02-01 00:00:00 [workingdays] => 1.00 [staff_email] => lee@unu.edu [staff_department] => Procurement & Administration Unit - KL [staff_name] => Angela LEE [enddate] => 2016-02-01 00:00:00 ) ) ) Fatal error: Uncaught Error: Call to undefined function array_count() in /in/63QHB:10 Stack trace: #0 {main} thrown in /in/63QHB on line 10
Process exited with code 255.
Output for 5.3.22 - 5.6.28
stdClass Object ( [data] => Array ( [0] => stdClass Object ( [contactid] => 21405 [startdate] => 2016-01-25 00:00:00 [workingdays] => 1.00 [staff_email] => lee@unu.edu [staff_department] => Procurement & Administration Unit - KL [staff_name] => Angela LEE [enddate] => 2016-01-25 00:00:00 ) [1] => stdClass Object ( [contactid] => 21405 [startdate] => 2016-02-01 00:00:00 [workingdays] => 1.00 [staff_email] => lee@unu.edu [staff_department] => Procurement & Administration Unit - KL [staff_name] => Angela LEE [enddate] => 2016-02-01 00:00:00 ) ) ) Fatal error: Call to undefined function array_count() in /in/63QHB on line 10
Process exited with code 255.