Re: another simple array question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if (isset($values[4])
    unset($values[4]);

Cheers,

David Grant

cybermalandro cybermalandro wrote:
> I have an array with indexes 0 to 4 and I want to delete an element of the
> array if the index is equals 4. I want to delete the variable key and value.
> What is the best way to do so?
> 
> foreach ($values as $key => $val){
> 
> if ($key == "0") {
> //
> }
> if ($key == "3") {
> //
> }
> if ($key == "4") {
> //delete value from array
> 
> }
> }
> 
> Thanks!!!!!
> 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux