Re: [PHP] Re: removing an element from an array

2003-10-01 Thread Dennis Sterzenbach
"Angelo Zanetti" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > how do I find the position of the element in the array? based on the value > that is passed? if there a funtion for this or do I manually have to get > this value? > $key = array_search("value-to-search"); -- Dennis S

RE: [PHP] Re: removing an element from an array

2003-10-01 Thread Angelo Zanetti
PROTECTED] Subject: [PHP] Re: removing an element from an array > Is there no function to do this? It seems like alot of overhead to do this > process, especially if the array is big. comments? > Not if you do not create another array, which in my oppinion is totally unnecessary. I alway

[PHP] Re: removing an element from an array

2003-10-01 Thread Dennis Sterzenbach
> for ($i=$elpos; $i $array[$i] = $array[$i+1]; > } > unset($array[count($array)-1]); I found another possible solution, which should be more performant than the one above: $input = array ("a", "b", "c", "d", "e"); print_r($input); $offset = 2; $array1 = array_splice($input, 0, $offset); $ar

[PHP] RE: removing an element from an array

2003-10-01 Thread Christoffer Enedahl
Look up array_splice in the manual HTH/Christoffer

[PHP] Re: removing an element from an array

2003-10-01 Thread Dennis Sterzenbach
> Is there no function to do this? It seems like alot of overhead to do this > process, especially if the array is big. comments? > Not if you do not create another array, which in my oppinion is totally unnecessary. I always did the following after finding the position from where to strip off the