Skip to main content
13 events
when toggle format what by license comment
May 23, 2017 at 11:47 history edited URL Rewriter Bot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
May 9, 2011 at 10:08 vote accept AlexanderJohannesen
May 9, 2011 at 9:53 comment added AlexanderJohannesen Forget that last part, problem somewhere else. Good stuff. :)
May 9, 2011 at 7:09 comment added AlexanderJohannesen Hmm, I'm having a problem with your solution, in that items added don't seem to work (silent fail) if the key is set (ie. array ( 'somekey' => $something ) ). If there is no key (ie. array ( $something ) ) it works. Must be something that happens when you try to add the arrays together (ie. $before + $data + $after). Hmm.
May 9, 2011 at 3:55 comment added AlexanderJohannesen Thanks, Alix. It seems we agree on this. I may have to look into the PHP source files and see if there's an obvious enhancement to be made here. Of course, I could re-implement the whole thing as a linked object list and deal with this using internal indeces, but it seems a lot of work for what should be simple. Hmm. Thanks, btw. :)
May 9, 2011 at 3:45 comment added Alix Axel @AlexanderJohannesen: I just realized that the code I came up with was exactly the algorithm you described... Anyway, this doesn't seem to be possible, because array_set_position(): pt.php.net/manual/en/function.next.php#52362, pt.php.net/manual/en/function.next.php#83087, pt.php.net/manual/en/function.current.php#83212 and so on...
May 9, 2011 at 3:35 history edited Alix Axel CC BY-SA 3.0
added 1067 characters in body; added 51 characters in body
May 9, 2011 at 3:15 comment added Alix Axel @AlexanderJohannesen: Got it. I don't see any way to do that but let me think about it for a while.
May 9, 2011 at 3:10 comment added AlexanderJohannesen @Alix, yes, ok, I've updated the question. It's perhaps more about a better seek_and_set array position using keys question ... :)
May 9, 2011 at 2:52 comment added Alix Axel @AlexanderJohannesen: Yeah, I think I don't fully understand your question. Could you post some dummy data and the respective code / output?
May 9, 2011 at 2:45 comment added AlexanderJohannesen Hmm, well it doesn't keep (internal) positions of arrays intact, so I still need to reset and search/set it, no? I don't have a problem with the actual splicing, it's just that all splicings on offer destroys internal counters, forcing me to deal with a rather expensive manual operation.
May 9, 2011 at 2:18 history edited Alix Axel CC BY-SA 3.0
added 189 characters in body; added 11 characters in body; added 79 characters in body
May 9, 2011 at 2:09 history answered Alix Axel CC BY-SA 3.0