Get Values from nested multidimensional Array

Hi I am trying to get “fulltext” values from this json file on this Link

I am getting only top of the array how can I get all values from all arrays even the nested ones

$json_output = json_decode($json, true);
foreach($json_output['results'] as $item) {
    echo '<br/>'. $item['fulltext'];

The linked item is not json, it’s array notation.

Personally, I’d use a preg_match_all, but as you want to loop:

foreach($output['results'] AS $result) {
 foreach($result['printouts']['Covers topic'] AS $topic) {
   echo "<br />".$topic['fulltext'];
 echo "<br />".$result['fulltext'];

Great Awesome


Hi StarLion

I need to ask one more question for this:

is it possible to make $result[‘fulltext’] as links that open a new window displaying the $topic[‘fulltext’] of its specific array?


Theoretically, sure.
Either have the new window call it’s own fetch of the array and isolate the desired result, or pass the fulltext on to the page as a GET (not really recommended, but it’d work at least).

Any example you can show me?

Have the new window walk the array (foreach), looking for a result (or a covers-topic) that has the name you’re looking for (which would be passed to it via a $_GET variable such as newwindow.php?name=SCI1021 ), and access that element’s fulltext entry.


worked like a charm