title: Select selected not working in_array php
body: <p>Is there any way to set the selected item in a drop down box in_array.
  but Selected="selected" not working for me.only few Selected value is showing drop down and it's not selected </p>
  
  <p>I tried the following code</p>
  
  <pre><code>&lt;label for="assignedto"&gt;Assigned to&lt;/label&gt;
  @foreach($menu as $menus)
     &lt;?php
       $assignedid=$menus-&gt;assigned_to;
       $assid[]=explode(',',$assignedid);
  
     ?&gt;
  @endforeach
  &lt;?php $maxcount= count($assid); echo '&lt;pre&gt;';print_r($assid); ?&gt;
        &lt;select id="framework1" name="Roles[]" multiple class="form-control" &gt;
          &lt;?php $a= 0;?&gt;          
            @foreach($roles as $id=&gt;$name)
         &lt;?php $newcount=count($assid[$a]);?&gt;
         &lt;option value="{{$id}}"@if(in_array($id, $assid[$a]))selected="selected"@endif&gt;{{$name}}&lt;/option&gt;
  &lt;?php  
  $a++; 
  if($a==$maxcount) break; 
  ?&gt;
  @endforeach
  </code></pre>
  
  <p>Here: </p>
  
  <pre><code>$assid=Array
  (
      [0] =&gt; Array
          (
              [0] =&gt; 6
              [1] =&gt; 2
              [2] =&gt; 3
          )
  
      [1] =&gt; Array
          (
              [0] =&gt; 4
              [1] =&gt; 5
              [2] =&gt; 6
          )
  
      [2] =&gt; Array
          (
              [0] =&gt; 6
          )
  
      [3] =&gt; Array
          (
              [0] =&gt; 2
              [1] =&gt; 3
          )
  
  )
  </code></pre>
  
  <p>And roles array is:      </p>
  
  <pre><code>$roles=Illuminate\Support\Collection Object
  (
      [items:protected] =&gt; Array
          (
              [1] =&gt; admin
              [12] =&gt; asdasd
              [13] =&gt; asdfgf
              [4] =&gt; manager
              [7] =&gt; NewRole
              [8] =&gt; NewRole12
              [9] =&gt; NewRole13
              [10] =&gt; NewRole14
              [11] =&gt; NewRole15
              [5] =&gt; supervisor
              [6] =&gt; Tester
              [2] =&gt; user
              [3] =&gt; User2
          )
  
  )
  </code></pre>
  
  <p>For first Iteration I want to select ids 4,5,6 means manager,supervisor,Tester should be selected and similarly second iteration 4,5,6 selected etc
  But selected for multiple select is not working for me.please help me.any help would be appreciated </p>