I have a JSON-encoded array, but in one of the array values is a "$" in the array name. When I will read the value with the follow code below, didn't get I an value.
<?php
error_reporting("E_ERROR");
date_default_timezone_set("Europe/Amsterdam");
$json = file_get_contents('http://jotihunt.net/api/1.0/nieuws');
$json = json_decode($json, true);
foreach ($json as $key1 => $item) {
foreach ($item as $key2 => $value) {
$id = $item['$id'];
echo gmdate("d-m-Y H:i", strtotime('+2 hours', $value['datum'])) . ' ' . $value['titel'] . ' met ID: '.$id.'<br/>';
}
}
?>
Below the JSON array from $item
Array
(
[0] => Array
(
[ID] => Array
(
[$id] => 52532555a08789e17900000d /* Can't read this with $item[$id] because the "$" before "id" */
)
[titel] => API 1.0 /* $value['titel'] */
[datum] => 1381180320 /* $value['datum'] */
)
[1] => Array
(
[ID] => Array
(
[$id] => 524b16eaa08789806a000010
)
[titel] => Inschrijving gesloten
[datum] => 1380652260
)
Does anyone know how I can read $id?