-1

I want to output some array data (>30.000 indexes) in php using a JavaScript alert box. So I create the string in a for loop containing all of my data with

$content .= '\\n' . data[$i];

Then I want to output the data using

echo "<script type='text/javascript'>
alert('$content');
</script>";

I'm just wondering what the maximum number of lines is that you can input in a php string or a javascript alert box. I know it won't display 30.000 lines but what is the maximum number?

Dennis Konoppa
  • 189
  • 1
  • 3
  • 13

1 Answers1

0

A string can be as large as 2GB.

For more detailed information, check this post:

What is the maximum length of a String in PHP?

Community
  • 1
  • 1
Miguel Xoel Garcia
  • 307
  • 1
  • 4
  • 18
  • And yes, this question looks like a duplicate. – Miguel Xoel Garcia Aug 06 '15 at 12:56
  • I closed it as a dupe which mostly contains info about the JS side, so you remark about php is still useful. Although if you put a 2GB string in a alert big you probably have bigger problems :P – PeeHaa Aug 06 '15 at 12:58