Page 1 of 1

PHP Arrays

Posted: Fri Mar 06, 2009 8:01 am
by james3302
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


I have code that looks like this

Code: Select all

 
$wc202Array = array(
//in here I have around 150 entries
);
 
$sql = '';
foreach($wc202Array as $wc)
{
   $sql .= "In here I have a select statment and unions the others as it loops through";
}
 
$sql = substr($sql, 0, -6);  //get rid of last "union"
$stmt = OCIParse($connection, $sql); 
OCIExecute($stmt); 
 
How many entries can I have in my array? I have heard that it depends on the menory_limit in the PHP.ini file. Is there any faster way to do this code?


pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.

Re: PHP Arrays

Posted: Fri Mar 06, 2009 10:19 am
by BomBas
Maybe this code can be more effective, it depends on what you want to do.

Re: PHP Arrays

Posted: Fri Mar 06, 2009 10:27 am
by pickle
Technically I guess there would be a limit, but it's extraordinarily high. The default memory limit is 8MB. Have you ever looked at an 8MB text file? There's tons of stuff in there. For the vast majority of practical applications, the size of arrays can be considered infinite.

Re: PHP Arrays

Posted: Fri Mar 06, 2009 1:50 pm
by kaisellgren
pickle wrote:Technically I guess there would be a limit
No guessing. There is a limit, but very rarely it is a practical limit.

Re: PHP Arrays

Posted: Fri Mar 06, 2009 2:34 pm
by james3302
The sql statment totals then length of a cable, or sums the number of records depends on what it's conuting. Then it displays it inside a table. Some php pages have about 10 different sql statements with loops.

Re: PHP Arrays

Posted: Fri Mar 06, 2009 2:39 pm
by Benjamin
Well you are not even remotely close to hitting any sort of limit.