On 3/12/2001 1:38 PM this was written:

> I want to take one element out of an array, is there a way to remove an
> element and have the array resorted so there isn't a blank spot where I
> remove the elements? Here is an example if the above text made no sense.
> 
> Example: $array = Array("1", "2", "3", "4");
> 
> So: $array[0] = 1, $array[1] = 2, $array[2] = 3, $array[3] = 4
> 
> I want to kick $array[2] out and have $array[3] be moved to $array[2]

Only thing I can think of is a loop:

$temparray = array();
Reset($array);
while ($elem = current($array)) {
    if ($elem != "2") {
        $temparray[] = $elem
    }
    next($array);
}
$array = $temparray;


-- 

Thomas Deliduka
IT Manager
     -------------------------
New Eve Media
The Solution To Your Internet Angst
http://www.neweve.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to