为什么我的数组增加了php laravel 5

I have an array which contains data from the database:

$responses = FormResponses::where('form_id', '>=', $phoneFirstElement->id)->where('form_id', '<=', $phoneLastElement->id)->get();
$responsesArray = $responses->toArray();

Then my nested loop:

  foreach ($phone as $key => $value2) // Populate Phone Numbers Horizontally
  {
      $sheet->cell($start.'9', $value2->phone);
      // This will fill the responses for each number
      foreach ($metrics as $key => $value)
      {
        $form_id = $value2->id;
        $metrics_id =  $value->id;
        $neededObjects = array_filter(
            $responsesArray,
            function ($e) use ($form_id, $metrics_id) {
                return $e['form_id'] == $form_id && $e['metrics_id'] == $metrics_id;
            }
        );
        var_dump($neededObjects); 
        exit;

        //$responses = FormResponses::where('form_id', '=', $value2->id)->where('metrics_id', '=', $value->id)->get();
        //$sheet->cell($start.$count, $neededObjects[$counter]['response']);
        $sheet->cell('C'.$count, $value->question);
        $sheet->cell('B'.$count, $value->description);
        $sheet->cell('A'.$count, $value->metrics_name);
        $counter++;
        $count++;
        $neededObjects = array();
      }
      $start++;
      $count = 10;
      //$counter = 0;
  }

My $responsesArray is the data which has lots of record, so I want to extract those data to get the specific one I need using array_filter and storing it in

$neededObjects

However when I make a var_dump I get something like

  array (size=1)
  0 => 
    array (size=7)
      'id' => int 141730
      'form_id' => int 4430
      'metrics_id' => int 1
      'response' => string 'Yes' (length=3)
      'remarks' => string '' (length=0)
      'created_at' => string '2015-11-23 19:30:07' (length=19)
      'updated_at' => string '2015-11-23 19:30:07' (length=19)

Then when the next records loops in

    array (size=1)
    1 => 
    array (size=7)
      'id' => int 141731
      'form_id' => int 4430
      'metrics_id' => int 2
      'response' => string 'Yes' (length=3)
      'remarks' => string '' (length=0)
      'created_at' => string '2015-11-23 19:30:07' (length=19)
      'updated_at' => string '2015-11-23 19:30:07' (length=19)

I don't understand why it is increamenting. The first one is 0 then next is 1 . Yes given that I am making an array_filter inside a nested loop but I didn't put any inreament vairables to it and the array filter will aways give me 1 record of data so I am expecting it atleast to be in index 0 or just a format like this:

array (size=7)
  'id' => int 141731
  'form_id' => int 4430
  'metrics_id' => int 2
  'response' => string 'Yes' (length=3)
  'remarks' => string '' (length=0)
  'created_at' => string '2015-11-23 19:30:07' (length=19)
  'updated_at' => string '2015-11-23 19:30:07' (length=19)

Any results that are returned by array_filter maintain their old keys. If you want the keys to reset then apply array_values to the result.

If you only want one result then call current() or array_pop() on the result to get the first record.

Even if array_filter returns one record, it will still be in the original array with the same key.

array_filter returns the array elements with their keys intact depending upon your filter function. So the keys (0, 1 etc) are the keys in your original array. Use array_pop to get the only element in your array.