@ 2014-06-01T18:53:30Z <?php
$json = '{
"categories":{
"sermons":[
{
"title":"We Have Overcome the World" ,
"url":"http://test.solidrockchristianfellowship.com/sermons/we-have-overcome-the-world/" ,
"content":"" ,
"date":"May 22, 2014",
"datetime":"2014-05-22T13:41:49",
} ],
"events":[
{
"title":"SRCF Night of Prayer" ,
"url":"http://test.solidrockchristianfellowship.com/events/srcf-night-of-prayer/" ,
"content":"<p>Apr 4th at 7:30 pm SRCF Night of Prayer, Praise and the Word; Guest Speaker is Pastor Shirley Reid; Shekinah Glory Ministry; N. Charleston, SC</p>" ,
"date":"April 04, 2014",
"datetime":"2014-04-04T00:00:00",
}, {
"title":"Mighty Warrior" ,
"url":"http://test.solidrockchristianfellowship.com/events/mighty-warrior/" ,
"content":"" ,
"date":"April 19, 2014",
"datetime":"2014-04-19T00:00:00",
}, {
"title":"Solid Rock Spring Revival" ,
"url":"http://test.solidrockchristianfellowship.com/events/solid-rock-spring-revival/" ,
"content":"<p>SRCF Spring Revival; Guest Speaker is Apostle W. Lenard King; Pastor of New Covenant Evangelistic Center; Charleston, SC</p>" ,
"date":"April 23, 2014",
"datetime":"2014-04-23T00:00:00",
} ]
},
"pages":{
"About Us":
{
"title":"About Us" ,
"url":"http://test.solidrockchristianfellowship.com/about-us/"
},
"Bible Study with Pastor Faden":
{
"title":"Bible Study with Pastor Faden" ,
"url":"http://test.solidrockchristianfellowship.com/bible-study-with-pastor-faden/"
},
"Live Stream":
{
"title":"Live Stream" ,
"url":"http://test.solidrockchristianfellowship.com/live-stream/"
},
"Our Ministries":
{
"title":"Our Ministries" ,
"url":"http://test.solidrockchristianfellowship.com/our-ministries/"
},
"Our Mission":
{
"title":"Our Mission" ,
"url":"http://test.solidrockchristianfellowship.com/our-mission/"
},
"Our Pastor":
{
"title":"Our Pastor" ,
"url":"http://test.solidrockchristianfellowship.com/our-pastor/"
},
"Our Vision":
{
"title":"Our Vision" ,
"url":"http://test.solidrockchristianfellowship.com/our-vision/"
},
"Prayer Request":
{
"title":"Prayer Request" ,
"url":"http://test.solidrockchristianfellowship.com/prayer-request/"
},
"Service Times":
{
"title":"Service Times" ,
"url":"http://test.solidrockchristianfellowship.com/service-times/"
},
"Subscribe":
{
"title":"Subscribe" ,
"url":"http://test.solidrockchristianfellowship.com/subscribe/"
},
"Videos":
{
"title":"Videos" ,
"url":"http://test.solidrockchristianfellowship.com/videos/"
},
"What we Believe":
{
"title":"What we Believe" ,
"url":"http://test.solidrockchristianfellowship.com/what-we-believe/"
}
}
}
';
function test($jsondata){
// decode the json data for parsing
$json = json_decode($jsondata, true);
var_dump(json_last_error());
$todaysDate = date("Y-m-d");
$data = $json['categories']['events'] ;
foreach($data as $event) {
echo '<li>';
echo $event['title'];
echo $event['date'];
echo $event['datetime'];
echo '</li>';
}
}
?>
<pre><?php var_dump(test($json));?></pre>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.3.0 - 8.3.6 <pre>int(4)
Warning: Trying to access array offset on null in /in/EXrbH on line 110
Warning: Trying to access array offset on null in /in/EXrbH on line 110
Warning: foreach() argument must be of type array|object, null given in /in/EXrbH on line 112
NULL
</pre> Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 <pre>int(4)
Warning: Trying to access array offset on value of type null in /in/EXrbH on line 110
Warning: Trying to access array offset on value of type null in /in/EXrbH on line 110
Warning: foreach() argument must be of type array|object, null given in /in/EXrbH on line 112
NULL
</pre> Output for 7.4.0 - 7.4.33 <pre>int(4)
Notice: Trying to access array offset on value of type null in /in/EXrbH on line 110
Notice: Trying to access array offset on value of type null in /in/EXrbH on line 110
Warning: Invalid argument supplied for foreach() in /in/EXrbH on line 112
NULL
</pre> Output for 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 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 <pre>int(4)
Warning: Invalid argument supplied for foreach() in /in/EXrbH on line 112
NULL
</pre> Output for 5.2.0 - 5.2.17 <pre>
Fatal error: Call to undefined function json_last_error() in /in/EXrbH on line 108
Process exited with code 255 . Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 <pre>
Fatal error: Call to undefined function json_decode() in /in/EXrbH on line 106
Process exited with code 255 . Output for 4.4.5 - 4.4.9 <pre>
Fatal error: Call to undefined function: json_decode() in /in/EXrbH on line 106
Process exited with code 255 . Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.4 <pre>
Fatal error: Call to undefined function: json_decode() in /in/EXrbH on line 106
Process exited with code 255 . Output for 4.3.0 - 4.3.1 <pre>
Fatal error: Call to undefined function: json_decode() in /in/EXrbH on line 106
preferences:dark mode live preview
312.74 ms | 401 KiB | 460 Q