3v4l.org

run code in 300+ PHP versions simultaneously
<?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< count($json); $i++) { $dates .= $json->data[$i]->startdate. ", "; } echo $dates;
Output for git.master, git.master_jit, rfc.property-hooks
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 TypeError: count(): Argument #1 ($value) must be of type Countable|array, stdClass given in /in/XdJIN:10 Stack trace: #0 {main} thrown in /in/XdJIN on line 10
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
66.41 ms | 402 KiB | 8 Q