title: Laravel keeps giving me: "Undefined offset 2"
body: <p>I try foreach loop but it keeps giving me "Undefined offset 2".</p>
  
  <p>I tried also isset then I got "Undefined offset 1"</p>
  
  <p>My code:</p>
  
  <pre><code>foreach ($lineArrayResults as $lineArrayResultKey =&gt; $lineArrayResult)
  {
      $currentFormFieldId = $submittedFormFields[$lineArrayResultKey]; // this line gives me error.
      if($currentFormFieldId &gt; 0)
      {
          $newLeadDataArray[$currentFormFieldId] = [
              'field_name' =&gt; $formFields[$currentFormFieldId],
              'field_value' =&gt; $lineArrayResult
          ];
      }
  }
  </code></pre>