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

后端 未结 10 1594
一整个雨季
一整个雨季 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 03:56

    Edit: As Rob said, if your application is running out of memory, chances are it won't even get to the print_r line. That's kinda my hunch as well, but if it is a memory issue, the following might help.

    Take a look in the php.ini file for this line, and perhaps increase it to 16 or more.

    memory_limit = 8M
    

    If you don't have access to php.ini (for example if this was happening on a shared server) you can fix it with a .htaccess file like this

    php_value memory_limit 16M
    

    Apparently some hosts don't allow you to do this though.

提交回复
热议问题