I have 2 multidimensional arrays. I run the first one through a foreach
loop to gain data from it. then run the second foreach
loop inside the first creating a nested foreach
loop.then inside the second foreach
loop I run an if statement to compare a value from the first array to the second array and display some output which works, however I am a little concerned about long run-time. so my question is, is there a cleaner, neater way to write it with a shorter run type:
@foreach($arrayOne as $firstArray)
@foreach($arrayTwo as $secondArray)
@if($firstArray['id'] == $secondArray['linkedId'])
/*output some data*/
@endif
@endforeach
@endforeach