Re: [PHP] Deleting elements from the middle of an array

2011-03-16 Thread Tom Barrett
http://en.wikipedia.org/wiki/Two_Little_Dickie_Birds

Re: [PHP] Deleting elements from the middle of an array

2011-03-16 Thread Marc Guay
I copied this thread to some co-workers with the subject line Be glad that you're not programmers. Is it Friday yet? Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Deleting elements from the middle of an array

2011-03-15 Thread Peter Lind
On Mar 15, 2011 4:10 AM, Paul M Foster pa...@quillandmouse.com wrote: On Mon, Mar 14, 2011 at 10:14:53PM +0100, Peter Lind wrote: On 14 March 2011 22:10, Paul M Foster pa...@quillandmouse.com wrote: [snip] Remove the elements, then use sort(). I've given a simplified example. The

Re: [PHP] Deleting elements from the middle of an array

2011-03-15 Thread Jim Lucas
On 3/14/2011 2:02 PM, Jim Lucas wrote: On 3/14/2011 1:31 PM, Paul M Foster wrote: Here's what I need to do: I have an indexed array, from which I need to delete elements in the middle. Once completed, the indexes should be numerically in sequence, as they were when I first encountered the

Re: [PHP] Deleting elements from the middle of an array

2011-03-15 Thread Paul M Foster
On Tue, Mar 15, 2011 at 07:08:28AM +0100, Peter Lind wrote: On Mar 15, 2011 4:10 AM, Paul M Foster [1]pa...@quillandmouse.com wrote: On Mon, Mar 14, 2011 at 10:14:53PM +0100, Peter Lind wrote: On 14 March 2011 22:10, Paul M Foster [2]pa...@quillandmouse.com wrote:

Re: [PHP] Deleting elements from the middle of an array

2011-03-15 Thread Peter Lind
On Mar 15, 2011 5:05 PM, Paul M Foster pa...@quillandmouse.com wrote: On Tue, Mar 15, 2011 at 07:08:28AM +0100, Peter Lind wrote: On Mar 15, 2011 4:10 AM, Paul M Foster [1]pa...@quillandmouse.com wrote: On Mon, Mar 14, 2011 at 10:14:53PM +0100, Peter Lind wrote:

Re: [PHP] Deleting elements from the middle of an array

2011-03-15 Thread tedd
At 4:31 PM -0400 3/14/11, Paul M Foster wrote: Here's what I need to do: I have an indexed array, from which I need to delete elements in the middle. Once completed, the indexes should be numerically in sequence, as they were when I first encountered the array. That is: Before: $arr = array(0 =

Re: [PHP] Deleting elements from the middle of an array

2011-03-14 Thread Paul M Foster
On Mon, Mar 14, 2011 at 09:34:33PM +0100, Peter Lind wrote: On 14 March 2011 21:31, Paul M Foster pa...@quillandmouse.com wrote: Here's what I need to do: I have an indexed array, from which I need to delete elements in the middle. Once completed, the indexes should be numerically in

Re: [PHP] Deleting elements from the middle of an array

2011-03-14 Thread Peter Lind
On 14 March 2011 22:10, Paul M Foster pa...@quillandmouse.com wrote: On Mon, Mar 14, 2011 at 09:34:33PM +0100, Peter Lind wrote: On 14 March 2011 21:31, Paul M Foster pa...@quillandmouse.com wrote: Here's what I need to do: I have an indexed array, from which I need to delete elements in

Re: [PHP] Deleting elements from the middle of an array

2011-03-14 Thread Marc Guay
I've given a simplified example. The actual target array is multi-dimensional. Your questioni sn't entirely clear but there's lot of chatter about multidimensional arrays on the array_values() page that might provide a solution. -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Deleting elements from the middle of an array

2011-03-14 Thread Curtis Maurand
how about creating two arrays, one empty one. pop the elements you want out of the first array and push them to the second.  skip the push on the elements you don't want in the second array? Just a thought. --curtis Paul M Foster wrote: On Mon, Mar 14, 2011 at 09:34:33PM +0100, Peter Lind

Re: [PHP] Deleting elements from the middle of an array

2011-03-14 Thread Paul M Foster
On Mon, Mar 14, 2011 at 10:14:53PM +0100, Peter Lind wrote: On 14 March 2011 22:10, Paul M Foster pa...@quillandmouse.com wrote: [snip] Remove the elements, then use sort(). I've given a simplified example. The actual target array is multi-dimensional. Sort() won't work in a case like