jeudi 17 août 2017

PHP: Help resolving an undefined offset error exception pertaining to a foreach loop [duplicate]

I am receiving an undefined offset: 1 error exception for a for-each loop when the input for the scheduling tool I am trying to fix is empty. I'm newish to PHP/Laravel and have been assigned to fix someone else's code unfortunately.

I have researched other posts are have experimented with issets and array_key_exists if loops but may have been using them incorrectly? The error points to the first line of the foreach loop posted in the image. Thanks for the input

@foreach ($headliners[$location->id] as $h)
      @if  ($h['count'] > 2)
          <th colspan=""> </th>
      @else
          <th colspan="" class="vertical"><p> </p></th>
      @endif
@endforeach



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2w6x41j
via IFTTT

Aucun commentaire:

Enregistrer un commentaire