Need low-memory consuming operation similar to array_unshift

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

Need low-memory consuming operation similar to array_unshift

Post by tores »

Hi

Have this huge array (up to 4MB) which I might have to extend by prepending elements to it at its' start.
array_unshift might have done the trick but resets my numerical keys, so I can't use it.
Is there some other way to do this without eating additional MBs of memory... E.g array_pop mixed with array_reverse???
Any suggestions?

regards tores
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

Post by tores »

Think I will just use

Code: Select all

$a1 = $a2 + $a1
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post by djot »

Post Reply