php - compare two arrays depending on the order -


how can compare 2 arrays depending on order ex. if array 1 {1, 2 , 3} , array 2 {1,2,3} display true else ex. array 2 {1,3,2} display false.. code far..

    foreach($questions $question){                    $question_answers = orderinganswer::where('question_id', $question->id)                                     ->where('deleted',0)                                     ->get()                                     ->toarray();                      $question_answer = $request->except('_token', 'test_id');                     $answers = $question_answer[ $question->id];                                foreach($question_answers $answer){                                    if($answers === $question_answers ){                                        echo  "true";                                       }                                       else{                                      echo  "false";                                       }                                  }                } 

you can refer example: <select name="tags" multiple required> @foreach ($tags $name) @foreach($item->tags $itemtag)     @if($name == $itemtag->name)         <option value="{{$name}}" selected>{{$name}}</option>         <?php continue 2; ?>     @endif @endforeach <option value="{{$name}}">{{$name}}</option> @endforeach 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -