What's the maximum number of keys for an array in php

后端 未结 10 1622
一整个雨季
一整个雨季 2021-02-08 03:32

I\'m writing a php script where I call

$lines = file(\'base_list.txt\');

to break a file up into an array. The file has over 100,000 lines in

10条回答
  •  渐次进展
    2021-02-08 04:12

    Darryl Hein,

    Yeah, there isn't anything in the error logs. I even increased error reporting and still nothing relevant to print_r().

    In response to Jay: I ran

    echo count($lines);
    

    and I get a result of 105,546 but still print_r() only displays 7280.

    Taking Rob Walker's advice I looped over all the elements in the array and it actually contained all the results. This leads me to believe the issue is with print_r() itself instead of a limit to array size.

    Another weird thing is that I tried it on one of my REHL servers and the result was as it should be. Now I don't want to blame this on Windows/IIS but there you go.

    With the above in mind I think this question should be re-titled as it's no longer relevant to arrays but print_r.

提交回复
热议问题