Function can see variable

I tried it again (this time I uploaded 4 images.
when I did the var_dump($_FILES)
I got

<pre>array(1) {
["images"]=>
  array(5) {
  ["name"]=>
    array(8) {
    [0]=>
    string(22) "640x480_phpQqKALD.jpeg"
    [1]=>
    string(22) "640x480_phpbZW7zd.jpeg"
    [2]=>
    string(22) "600x450_phpoUO9n5.jpeg"
    [3]=>
    string(0) ""
    [4]=>
    string(0) ""
    [5]=>
    string(0) ""
    [6]=>
    string(22) "600x450_phpVtLKgY.jpeg"
    [7]=>
    string(0) ""
}
["type"]=>
array(8) {
  [0]=>
  string(10) "image/jpeg"
  [1]=>
  string(10) "image/jpeg"
  [2]=>
  string(10) "image/jpeg"
  [3]=>
  string(0) ""
  [4]=>
  string(0) ""
  [5]=>
  string(0) ""
  [6]=>
  string(10) "image/jpeg"
  [7]=>
  string(0) ""
}
["tmp_name"]=>
array(8) {
  [0]=>
  string(14) "/tmp/phpepJyFh"
  [1]=>
  string(14) "/tmp/phpawoJpm"
  [2]=>
  string(14) "/tmp/phpjlXU9q"
  [3]=>
  string(0) ""
  [4]=>
  string(0) ""
  [5]=>
  string(0) ""
  [6]=>
  string(14) "/tmp/php7sE7Tv"
  [7]=>
  string(0) ""
}
["error"]=>
array(8) {
  [0]=>
  int(0)
  [1]=>
  int(0)
  [2]=>
  int(0)
  [3]=>
  int(4)
  [4]=>
  int(4)
  [5]=>
  int(4)
  [6]=>
  int(0)
  [7]=>
  int(4)
}
["size"]=>
array(8) {
  [0]=>
  int(52015)
  [1]=>
  int(78430)
  [2]=>
  int(58013)
  [3]=>
  int(0)
  [4]=>
  int(0)
  [5]=>
  int(0)
  [6]=>
  int(38768)
  [7]=>
  int(0)
    }
  }
}

But I still have 5

Notice: Undefined index: name in /home/luke69/public_html/admin/insert_provider.php on line 153
Error: File too big ( < 500Kb) or wrong type (gif, jpg, bmp, or png)
(heres my foreach loop,

  foreach ($_FILES['images'] as $image) {
  

	  $ext = strtolower(pathinfo($image['name'], PATHINFO_EXTENSION));

	  if( (in_array($ext, ['jpg', 'jpeg', 'gif', 'png', 'bmp']) && ($image["size"] < 512000)) ){ 
		   
		  $filename = $image['name'];
		  $source = $image['tmp_name'];   
		  $target = $path_to_image_directory . $filename;
		   
		  move_uploaded_file($source, $target);
			   
	  } else {
		  echo "<p class='text-danger'><span class='glyphicon glyphicon-remove'></span>&nbsp;&nbsp;Error: File too big ( < 500Kb) or wrong type (gif, jpg, bmp, or png)</p>";
	  }
	} 

shouldn’t it only run 4 times, and give no error?