title: How to decode a multidimensional json array in lararvel with 'foreach' for specific values?
body: <p>I tried to figure out in php how to receive specific values from a json file with the 'foreach' but so far I didn't got what I wanted to. I marked each of the lines with '//!' that indicates what I want to echoing out with the 'foreach'. </p>
  
  <p>My main goal with this to use it in Laravel, after I got the logic with pure php. So maybe you know a better solution before the process.</p>
  
  <p>So I would like to receive the datas likes this:
  (just the data and not more)</p>
  
  <p>(This section below will not change or extend, just to keep it mind the loop)</p>
  
  <ul>
  <li>Meeting information</li>
  <li>1</li>
  <li>2017-05-11 18:59:13</li>
  <li>2017-05-11 19:03:39</li>
  <li>2016-01-30 13:30:00</li>
  <li>Test Meeting 2</li>
  <li>Test</li>
  </ul>
  
  <p>(This and further sections below (or upcoming) will change and extend)</p>
  
  <ul>
  <li>20</li>
  <li>subject_02@test.com</li>
  <li>2017-05-19 17:40:25</li>
  <li>2017-05-19 17:40:25</li>
  </ul>
  
  <p>(So this section gonna be a redundant with different datas as you can see)</p>
  
  <ul>
  <li>21</li>
  <li>subject_03@test.com</li>
  <li>2017-05-19 20:11:18</li>
  <li><p>2017-05-19 20:11:18</p>
  
  <p>{
    "msg": "Meeting information",
    "meeting": {
      "id": 1,
      "created_at": "2017-05-11 18:59:13",
      "updated_at": "2017-05-11 19:03:39",
      "time": "2016-01-30 13:30:00",
      "title": "Test Meeting 2",
      "description": "Test",
      "view_meetings": {
        "href": "api/v1/meeting",
        "method": "GET"
      },
      "users": [
        {
          "id": 20,
          "name": "Subject_02",
          "email": "subject_02@test.com",
          "created_at": "2017-05-19 17:40:25",
          "updated_at": "2017-05-19 17:40:25",
          "pivot": {
            "meeting_id": 1,
            "user_id": 20
          }
        },
        {
          "id": 21,
          "name": "Subject_03",
          "email": "subject_03@test.com",
          "created_at": "2017-05-19 20:11:18",
          "updated_at": "2017-05-19 20:11:18",
          "pivot": {
            "meeting_id": 1,
            "user_id": 21
          }
        }
      ]
    }
  }</p></li>
  </ul>
  
  <p>PHP Code</p>
  
  <pre><code>&lt;?php 
  $data = file_get_contents("/Applications/MAMP/htdocs/meeting.json");
  $json = json_decode($data  = file_get_contents("/Applications/MAMP/htdocs/meeting.json"), true);
  // $push = var_dump($json);
  
  // echo print_r($json, true) . "&lt;br&gt;" . "&lt;br&gt;";
  
  echo "Static paths:" . "&lt;br&gt;" . "&lt;br&gt;";
  
  echo ' =&gt; ' . $json . "&lt;br&gt;";
  
  echo '[msg] =&gt; ' . $json[msg] . "&lt;br&gt;" . "&lt;br&gt;";//!
  
  echo '[meeting] =&gt; ' . $json[meeting] . "&lt;br&gt;";
  echo ' - [id] =&gt; ' . $json[meeting][id] . "&lt;br&gt;";//!
  echo ' - [created_at] =&gt; ' . $json[meeting][created_at] . "&lt;br&gt;";//!
  echo ' - [updated_at] =&gt; ' . $json[meeting][updated_at] . "&lt;br&gt;";//!
  echo ' - [time] =&gt; ' . $json[meeting][time] . "&lt;br&gt;";//!
  echo ' - [title] =&gt; ' . $json[meeting][title] . "&lt;br&gt;";//!
  echo ' - [description] =&gt; ' . $json[meeting][description] . "&lt;br&gt;" . "&lt;br&gt;";//!
  
  echo ' - [view_meetings] =&gt; ' . $json[meeting][view_meetings] . "&lt;br&gt;";
  echo ' - - [view_meetings] =&gt; ' . $json[meeting][view_meetings][href] . "&lt;br&gt;";
  echo ' - - [view_meetings] =&gt; ' . $json[meeting][view_meetings][method] . "&lt;br&gt;" . "&lt;br&gt;";
  
  echo ' - [users] =&gt; ' . $json[meeting][users] . "&lt;br&gt;" . "&lt;br&gt;";
  
  echo ' - [0] =&gt; ' . $json[meeting][users][0] . "&lt;br&gt;";
  echo ' - - [id] =&gt; ' . $json[meeting][users][0][id] . "&lt;br&gt;";//!
  echo ' - - [email] =&gt; ' . $json[meeting][users][0][email] . "&lt;br&gt;";//!
  echo ' - - [created_at] =&gt; ' . $json[meeting][users][0][created_at] . "&lt;br&gt;";//!
  echo ' - - [updated_at] =&gt; ' . $json[meeting][users][0][updated_at] . "&lt;br&gt;" . "&lt;br&gt;";//!
  
  echo ' - - [pivot] =&gt; ' . $json[meeting][users][0][pivot] . "&lt;br&gt;";
  echo ' - - - [meeting_id] =&gt; ' . $json[meeting][users][0][pivot][meeting_id] . "&lt;br&gt;";
  echo ' - - - [user_id] =&gt; ' . $json[meeting][users][0][pivot][user_id] . "&lt;br&gt;" . "&lt;br&gt;";
  
  echo ' - [1] =&gt; ' . $json[meeting][users][1] . "&lt;br&gt;";
  echo ' - - [id] =&gt; ' . $json[meeting][users][1][id] . "&lt;br&gt;";//!
  echo ' - - [email] =&gt; ' . $json[meeting][users][1][email] . "&lt;br&gt;";//!
  echo ' - - [created_at] =&gt; ' . $json[meeting][users][1][created_at] . "&lt;br&gt;";//!
  echo ' - - [updated_at] =&gt; ' . $json[meeting][users][1][updated_at] . "&lt;br&gt;" . "&lt;br&gt;";//!
  
  echo ' - - [pivot] =&gt; ' . $json[meeting][users][1][pivot] . "&lt;br&gt;";
  echo ' - - - [meeting_id] =&gt; ' . $json[meeting][users][1][pivot][meeting_id] . "&lt;br&gt;";
  echo ' - - - [user_id] =&gt; ' . $json[meeting][users][1][pivot][user_id] . "&lt;br&gt;" . "&lt;br&gt;" . "&lt;br&gt;";
  
  echo "Dynamic paths:" . "&lt;br&gt;" . "&lt;br&gt;";
  
  
  foreach ($json as $key) {
  
      echo $key[users][0][id] . "&lt;br&gt;";
      echo $key[users][0][email] . "&lt;br&gt;";
  }
  </code></pre>