$nums = array ('one', 'two', 'three');
$nums = remove_array_element($nums, 1);

function remove_array_element($array, $index)
{
    unset($array[$i]);  // Unset selected index
    return array_values($array); // Return reindexed array
}

P.S. The empty() function returns true or false depending upon whether or
not the variable you pass to contains information, it doesn't affect the
variable.

-Kevin

----- Original Message -----
From: "Martin Clifford" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 12, 2002 12:48 PM
Subject: [PHP] Emptying a Single Array Value


> Howdy,
>
> If someone out there could tell me how to get rid of a single key/index
pair within an array, it would be great.  I've tried both unset() and
empty(), but both destroy the entire array.
>
> Please CC me directly, as I'm on the digest.
>
> Thanks in advance!
>
> Martin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to