Re: Removing an element from the middle of an mdlti-dimentsional array

From: Date: Fri, 15 Aug 2008 03:16:02 +0000
Subject: Re: Removing an element from the middle of an mdlti-dimentsional array
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-278113@lists.php.net to get a copy of this message
Not on the specific sub element. I.e unset($array[2][0]) On Aug 14, 2008, at 8:08 PM, "Don" <don@program-it.ca> wrote:
Won't unset() destroy the entire array? "mike" <mike503@gmail.com> wrote in message news:071A7FC9-7894-48AB-95B8-A7ECAA81D13E@gmail.com...
Can't you unset() it? Sorry for top posting I'm on an iPhone On Aug 14, 2008, at 7:30 PM, "Don" <don@program-it.ca> wrote:
Hi, Let's say I have the following array: $myArray = array(array('1','2','3'), array('4','5','6'), array('7','8','9'), array('10','11','12')); How do I remove say the second element? I have tried: $myArray = array_splice($myArray, 1, 1); But this seems to remove the second element as well as all the following elements and I am left with: $myArray = array(array('1','2','3')); when I really want: $myArray = array(array('1','2','3'), array('7','8','9'), array('10','11','12')); Thanks, Don
--PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#278113) next »