title: How to pass multidimensional array in laravel blade?
body: <p>I have try to pass the multidimensional array to view. But when I try to print It will give me error. Below are the code and error.</p>
  
  <p>Controller File:</p>
  
  <pre><code>foreach($countrygroup as $val){
          //$userArr[] = $val-&gt;userid;
          $users =  DB::table('timelines')-&gt;where('id', '=', $val-&gt;userid)-&gt;first();
          $userArr[$val-&gt;userid]['name'] = $users-&gt;name;//$users-&gt;name;
          $userArr[$val-&gt;userid]['avatar'] = $users-&gt;avatar_id;
          //$userArr[$val-&gt;userid]['image']=$users-&gt;image;            
      }
      //echo '&lt;pre&gt;'; print_r($userArr); die();
        return $theme-&gt;scope('groups/country', compact('userArr','trending_tags','countrygroupnamee'))
        -&gt;render();
  </code></pre>
  
  <p>Blade File Code:</p>
  
  <pre><code>@foreach($userArr as $users)
      &lt;h2&gt;{{ $users}}&lt;/h2&gt;                                                                
   @endforeach
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/2LjqI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2LjqI.png" alt="enter image description here"></a></p>
  
  <p>Thanks</p>