Hi there !
Is there a size limit for a string variable ? Could anything from the way PHP is configured limit the size of my variables ?
thanx.
Hi there !
Is there a size limit for a string variable ? Could anything from the way PHP is configured limit the size of my variables ?
thanx.
Hi there !
Is there a size limit for a string variable ? Could anything from the way PHP is configured limit the size of my variables ?
thanx.
That is a damn good question. If I draw on past experience, it most likely is 32k or 64k. (32767 or 65535) for strings. The manual doesn't seem to say.
There is a max_memory string in the configuration. This will affect it at the top end.
Why don't you create a huge variable and find out?
For the purposes of your PHP program, (I assume you're working with large files) make your variables up to 8k or so, and then flush them.
Michael
My normal max execution time of 10s. I had to up this, because it took 12 seconds to process my "huge" variable.
My variable was 4587450 bytes long. (String, naturally. (4.5 short meg, dude. =)
My source is here:
<head></head><body>
<?
for ($i = 0; $i <= 65535; $i++) {
$a .="0123456789";
$a .="0123456789";
$a .="0123456789";
$a .="0123456789";
$a .="0123456789";
$a .="0123456789";
$a .="0123456789<BR>";
}
Print $a;
?></body>
Please note (!): My particular PHP is memory-limited to 8meg by default, which yours might be too. I'm using the win32 binaries.
Internet Explorer quits displaying somewhere after 4.5 meg. (If you can't display it, what good is it?) They figure, 4.5 meg should be good enough for anyone. (Much like the 640k barrier.( My PHP still processed variables up to near 7 meg, I believe, but I couldn't print them, so what good is it, proof wise.) Try outputting a 7 meg variable to disk. UGG!
Does this help any?
Michael
Well yes and no. I have new leads to explore (especially the max execution time) but I still cannot figure out what happened to my variable since it was displayed and sent via email wrapped although some much bigger one were sent complete. And it's only between 20 and 60kB big anyway.
thanx for the help and I'll keep everyone posted if I eventually find out the answer.
H,
I am Vinayak,
I want to know that is there any way to find out the size of array in bytes.