[thelist] Php array, best way to...

Ron Dorman rwd at csi1st.net
Mon Jul 12 21:03:50 CDT 2004


jsWalter wrote:

>>Look at using the array_slice function.  It will return a 
>>subset of the array contents as it's own array.  you could
>>then use array_merge to append it to your tmpArray.
>>    
>>
>
>Interesting idea, but I discounted this because it modified the orginal
>array.
>
>Not my intent.
>
>I wanted to pull a subset out and not touch the orginal.
>
Slice the original into the subs, then merge the subs back into the 
original, then merge them into the temps or leave them as subs, or . . .

Or, maybe, when originally building the array, build each sub of 75 
elements into a temp array and the big array at the same time.

How are you building the array to begin with (it's easy to put the value 
of a variable into two arrays at the same time)? Does it come from a 
query? Form processing?

Do you really need the big array for processing somewhere and the sub 
arrays for processing somewhere else?

How about a nested FOR EACH loop? Or a FOR EACH loop in a WHILE statement?

More information about how the array is built and what it should do 
would help in suggesting the bet way to retrieve sub arrays.

Ron D.


More information about the thelist mailing list