PHP error impode limit?

I have a script that creates an array with approximately 40,000 entries, PHP arrays have no limits other than server memory ...

However, the PHP function implode() simply does not output anything, trying to blow up an array of about 40,000 entries per line. Each array entry has aZ value. Memory errors, no errors!

Can anyone confirm this?

I am not sure you can post examples!

EDIT (2013-06-03):

I can confirm that the PHP memory limit was set to -1, and PHP errors should have been equal to E_ALL. Where there are no errors and there is simply no conclusion. This seems to be a bug in PHP.

I used echo implode("<br>\n", $myLogArr); with an error and did not display anything, I have mananage to get the correct expected result using foreach ($myLogArr as $line) echo $line."<br>\n";

+1
source share
3 answers

The following works very well - with 50,000 entries.

 <?php $arr = array(); for ($i = 0; $i < 50000; $i++) { $arr[] = str_shuffle('This sentance is of average length, which The Internet says is about 14.2 words.'); } echo implode(PHP_EOL, $arr); 

I would suggest increasing error_reporting and trying to debug this further.

Anthony.

+1
source

memory_limit to -1, and then execute the script in a catch catch block

0
source
 $string = str_repeat("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz,",1000000); $array = explode(",", $string); var_dump(sizeof($array), strlen(implode(",", $array))); 

outputs:

 int 1000001 int 53000000 

OP, can you show your code?

0
source

All Articles