title: How to save multiple results in the array with for loop php
body: <p>I'm working with a CSV file. when the user uploads the file. I parse the CSV then select the data from the array that I need. after that, I'm running a <code>for loop</code> to validate that data and saving the results in the array. but the problem is when I print the results array there's only result for 1 email and there are 4 emails. any suggestions?</p>
  
  <pre><code>$results = [];
  $valid_emails = 0;
  $invalid_emails = 0;
  
  for ($i = 0; $i &lt; $csv_array['row_count']; $i++) {
    $email = $csv_array['data'][$i][$email_column];
  
    $result = validate_email($email);
    $results['Email'] = $email;
  
    if ($result) {            
      $results['Result'] = 'valid';
      $valid_emails++;
    } else {
      $results['Result'] = 'invalid';
      $invalid_emails++;
    }
  
  }
  
  echo '&lt;pre&gt;';
  print_r($results);
  echo '&lt;/pre&gt;&lt;br&gt;';
  
  echo $valid_emails . '&lt;br&gt;';
  echo $invalid_emails . '&lt;br&gt;';
  </code></pre>