我怎样才能遍历大型数组?

I created an array from a very large text file with more than 10.000 entries. This is how my textfile is formatted:

1232.cat=Fred
1232.age=13
1232.size=44
1232.food=chicken
1233.cat=Moe
1233.age=4
1233.size=23
1233.food=fish

This is my $animals array:

 array(9435) {
  [0]=>
  array(5) {
    ["number"]=>
    string(4) "1232"
    ["cat"]=>
    string(4) "Fred"
    ["age"]=>
    string(2) "13"
    ["size"]=>
    string(2) "44"
    ["food"]=>
    string(7) "chicken"
   }
   ...(and so on)

I want to do various checks, for example if for each number cat exists.

    foreach($animals as $row) {
        if(empty($row['cat'])){
        echo "cat is missing in number: ".$row["number"];
       } 
    }

This is working very well for textfiles with around 3000 entries. But for larger files I cannot get any results. So my question is, what can I do. Obviously I cannot loop through very large arrays. But what is my alternative?