<?php$json=file_get_contents("http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373");$data=json_decode($json);if(count($data->stand)){// Open the tableecho"<table>";// Cycle through the arrayforeach($data->standas$idx=>$stand){// Output a rowecho"<tr>";echo"<td>$stand->afko</td>";echo"<td>$stand->positie</td>";echo"</tr>";}// Close the tableecho"</table>";}?>
<?php$json=file_get_contents("http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373");$data=json_decode($json);if(count($data->stand)){// Open the tableecho"<table>";// Cycle through the arrayforeach($data->standas$idx=>$stand){// Output a rowecho"<tr>";echo"<td>$stand->afko</td>";echo"<td>$stand->positie</td>";echo"</tr>";}// Close the tableecho"</table>";}?>
$json='{"a":1,"b":2,"c":3}';var_dump(json_decode($json));//converts json to array$array=["a"=>1,"b"=>2,"c"=>3];echojson_encode($json_encode($json));//converts array to json
<?php$json=file_get_contents("http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373");$data=json_decode($json);if(count($data->stand)){// Open the tableecho"<table>";// Cycle through the arrayforeach($data->standas$idx=>$stand){// Output a rowecho"<tr>";echo"<td>$stand->afko</td>";echo"<td>$stand->positie</td>";echo"</tr>";}// Close the tableecho"</table>";}?>
<?php$json=file_get_contents("http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373");$data=json_decode($json);if(count($data->stand)){// Open the tableecho"<table>";// Cycle through the arrayforeach($data->standas$idx=>$stand){// Output a rowecho"<tr>";echo"<td>$stand->afko</td>";echo"<td>$stand->positie</td>";echo"</tr>";}// Close the tableecho"</table>";}?>
// Checks if jsonfunctionisJson($string){json_decode($string);returnjson_last_error()===JSON_ERROR_NONE;}// exampleif(isJson($string){// Do your stuff here}
<?php$json=file_get_contents("http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373");$data=json_decode($json);if(count($data->stand)){// Open the tableecho"<table>";// Cycle through the arrayforeach($data->standas$idx=>$stand){// Output a rowecho"<tr>";echo"<td>$stand->afko</td>";echo"<td>$stand->positie</td>";echo"</tr>";}// Close the tableecho"</table>";}?>
/** Checks if JSON and returns decoded as an array, if not, returns false,
but you can pass the second parameter true, if you need to return
a string in case it's not JSON */functiontryJsonDecode($string,$returnString=false){$arr=json_decode($string);if(json_last_error()===JSON_ERROR_NONE){return$arr;}else{return($returnString)?$string:false;}}
<?php$json=file_get_contents("http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373");$data=json_decode($json);if(count($data->stand)){// Open the tableecho"<table>";// Cycle through the arrayforeach($data->standas$idx=>$stand){// Output a rowecho"<tr>";echo"<td>$stand->afko</td>";echo"<td>$stand->positie</td>";echo"</tr>";}// Close the tableecho"</table>";}?>
<?php$json=file_get_contents("http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373");$data=json_decode($json);if(count($data->stand)){// Open the tableecho"<table>";// Cycle through the arrayforeach($data->standas$idx=>$stand){// Output a rowecho"<tr>";echo"<td>$stand->afko</td>";echo"<td>$stand->positie</td>";echo"</tr>";}// Close the tableecho"</table>";}?>