Re: in the middle of shift and pop

From: Date: Wed, 20 Aug 2003 01:49:32 +0000
Subject: Re: in the middle of shift and pop
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-160114@lists.php.net to get a copy of this message
Decapode Azur wrote:
is it possible to remove an element of an indexed array such as this exemple $A = array('a', 'b', 'c', 'd', 'e', 'f'); in a way that we can optain this result : $A = array('a', 'b', 'd', 'e', 'f'); something like that perhaps ? array_remove($A, 2); If such a function does not exists, what would be the more efficient way to do so a lot of time on very big arrays ?
the function exists and is called array_splice. eg: <? $A = array('a', 'b', 'c', 'd', 'e', 'f'); array_splice($A,2,1); print_r($A); ?> running this produces: Array (
    [0] => a
    [1] => b
    [2] => d
    [3] => e
    [4] => f
)

« previous php.general (#160114) next »