Timeline for Hard PHP nut : how to insert items into one associate array?
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 1, 2011 at 4:51 | comment | added | AlexanderJohannesen | @Tom Auger : Well, it does the splitting and inserting, but like all other solutions is a split and merge of arrays rather than a true insert. The problem is that when you've got thousands of these it becomes a resource and speed hog, and I've since looked into the PHP's C source code to see, and it seems I need to hack a more true insert (when I find time ... :) | |
Aug 31, 2011 at 13:31 | comment | added | Tom Auger | Does this answer meet your requirements? stackoverflow.com/questions/3353745/… | |
May 9, 2011 at 10:08 | vote | accept | AlexanderJohannesen | ||
May 9, 2011 at 4:51 | comment | added | AlexanderJohannesen | Well, I've gone through google.com/codesearch/p?hl=en#EKZaOgYQHwo/unstable/sources/…, and nothing jumps out, except some room for improvement with the Z_ARRVAL_PP implementation (near this comment in the source files; "/* * This is where the magic happens. */" :) Brilliant. | |
May 9, 2011 at 3:48 | answer | added | outis | timeline score: 2 | |
May 9, 2011 at 3:09 | history | edited | AlexanderJohannesen | CC BY-SA 3.0 |
more specifics, hopefully clearer
|
May 9, 2011 at 2:43 | comment | added | AlexanderJohannesen | samshull, not sure how you see a usage for that? Array_map iterates and runs functions over those items, but does not alter the number of items in an array, does it? | |
May 9, 2011 at 2:41 | comment | added | AlexanderJohannesen | Ed, yes, an apt point. Mostly this is a stack I'm iterating over, and events early on the stack might add events to be run later. | |
May 9, 2011 at 2:12 | comment | added | samshull | It sounds like you would be better off using array_map | |
May 9, 2011 at 2:09 | answer | added | Alix Axel | timeline score: 3 | |
May 9, 2011 at 2:08 | comment | added | Ed Marty | Can you guarantee that the item you're adding is AFTER the current position? If not, then it won't get processed anyway. | |
May 9, 2011 at 1:59 | history | asked | AlexanderJohannesen | CC BY-SA 3.0 |