![]() |
|
#1
|
||||
|
||||
PHP Arrays, how big can they get?I am just curious actually, the thought crossed my mind when I was thinking about doing something new and using arrays. But there's a possibility the array might even have to hold up to 100000 values - gasp! So, anyone know where I can get information like this?
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#2
|
||||
|
||||
|
I think array size depend at memory_limit setting in php.ini.
Default memory_limit = 8M. I look around for alittle bit tonight and this was what I found. I hope it helps Later __________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#3
|
||||
|
||||
|
You must be careful, because it also depends on the limits of what php can handle for namespace memory handling because at extremely large sizes, reliability becomes questionable.
I fonud this today and I thought I would let you know. __________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#4
|
||||
|
||||
|
namespace memory? What is that?
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
||||
|
||||
|
I'm not that sure I was talking to someone about a week ago and thats what he told me. I'll try to found out wht he was talking about.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#6
|
|||
|
|||
|
Namespace memory. I think it's got to do with PHP's parsing algorithm. As it looks through your php script, when it sees something like
PHP Code:
The more memory your script eats up, the more dangerous it becomes that the PHP engine might bugger up & overwrite segments of memory already being used. It's often a good idea to unset large arrays in your program once you've finished with them. PHP also supports multi-dimensional arrays, so a 10X10X10X10 4D array uses 10,000 slots, which can fill up memory very quickly. Garth Farley |
|
#7
|
||||
|
||||
|
Thanks guys, I think I should stick with saving the data in a database then...
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#8
|
||||
|
||||
|
You also need to remember that large arrays can take a long time to execute and there is a time out limit which can be set in php.ini. The default is like 60 seconds, if a script hasn't completely run through in that time it bails.
|
|
#9
|
|||
|
|||
|
...and it also has a memory limit, I believe the default is 4mb.
GF |
|
#10
|
||||
|
||||
|
I just looked in my php.ini and came up with:
memory_limit = 8M I haven't changed this option so I guess in 4.3.0 8MB is the default...I don't know about older versions... |
Recent GIDBlog
First week of IA training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Optimizing your web server with Turck MMCache for PHP | JdS | Web Hosting Forum | 2 | 07-Jan-2004 07:48 |
| apache2 - php cgi fehler - schleife | inna | Apache Web Server Forum | 8 | 27-Nov-2003 09:55 |
| [Linux] Installing PHP --with-mcrypt | JdS | Web Hosting Forum | 0 | 20-Aug-2003 08:40 |
| PHP in HTML | jrobbio | Web Design Forum | 4 | 24-Jul-2003 06:05 |
| All the big PHP script collections that matter | jrobbio | MySQL / PHP Forum | 5 | 06-Jun-2003 16:14 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The