Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Does PHP have a limit to size of array
Old 10-17-2011, 10:48 PM Does PHP have a limit to size of array
Extreme Talker

Posts: 172
Name: James
Location: Australia
Trades: 0
Does PHP have a limit to how many are in an array....

I mean, lets say we have array $array[].

Can we reach a spot in that array when PHP would say that is too many?

Say $array[1234] or $array[1234567]?

Also, is there a limit to the quantity of times that a loop will work to?


I have a PHP program to send out email messages as part of email marketing. But for some reason it will not load up the require() file containing the email addresses when there are a lot of addresses in the file.
TRANZIT JIM is online now
Reply With Quote
View Public Profile Visit TRANZIT JIM's homepage!
 
 
Register now for full access!
Old 10-17-2011, 11:36 PM Re: Does PHP have a limit to size of array
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
The only limitation (I'm aware of) on array size is the maximum memory allocation.

Similarly the only limitation on the number of loop iterations is the maximum execution time.

Quote:
I have a PHP program to send out email messages as part of email marketing. But for some reason it will not load up the require() file containing the email addresses when there are a lot of addresses in the file.
Require should be used when loading source files, not data. My guess is that the size of the file exceeds your maximum memory and require is trying to load the whole thing into memory.

Try using fread to load a fixed number of bytes in a loop. Depending on how your data is formatted you might have some issues with partial entries at the end of each segment. You can resolve this by saving the partial entries until you load the next segment.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by NullPointer; 10-17-2011 at 11:38 PM..
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 10-19-2011, 11:31 AM Re: Does PHP have a limit to size of array
vectorialpx's Avatar
Extreme Talker

Posts: 249
Name: octavian
Location: Bucharest
Trades: 0
I know it's not an answer but I suggest you to add all those mails into a mysql (or another) database and read them with a LIMIT. It's the same thing as NullPointer says about fread but in this case you have a lot more control (having some flag with send emails and so on).
__________________
you can
Please login or register to view this content. Registration is FREE
vectorialpx is offline
Reply With Quote
View Public Profile Visit vectorialpx's homepage!
 
Reply     « Reply to Does PHP have a limit to size of array
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14362 seconds with 12 queries