Array Remove



Is there an acutal function in PHP for removing an element of an array?

eg: array1 = ("zero", "one", "two", "three");
array1 = remove_element( array1, 2 );
// array1 now contains ("zero", "one", "three");

I have been trying the unset method but this seems to be corrupting my
array (which is holding a set of objects);

I can knock something together with aray_merge, array_splice and
similar but just didn't want to reinvent the wheel.

Thanks,

Rick
www.e-connected.com

.



Relevant Pages

  • Re: Remove from a collection
    ... allocates its underlying array (maybe after difference between ... when removing the first element. ... In a "RemoveFirst-Loop" your measured time is the sum of the ... I thought that it wouldn't shrink array on the way of removing ...
    (microsoft.public.vb.general.discussion)
  • Re: Weird $_POST behavior when trying to unset elements
    ... "array_remove" PHP FUNCTION IS MADE PART OF CORE IN THE FUTURE ... Remove a specific element from the array. ... removing the wrong element when you remove something by the value, ... AFTER JAVA Vector.removeElementAt ...
    (comp.lang.php)
  • Releasing memory (continuation)
    ... UDTs array would be the fastest). ... - Removing in reversed key order ... Release time in collection test seems to be spent 1/2 navigating thru the ... collection, 1/2 releasing memory. ...
    (microsoft.public.vb.general.discussion)
  • Re: Weird $_POST behavior when trying to unset elements
    ... Remove a specific element from the array. ... removing the wrong element when you remove something by the value, ... I have no trouble telling which element you ... I think the real problem here is actually that wrong elements are ...
    (comp.lang.php)
  • Re: Weird $_POST behavior when trying to unset elements
    ... "array_remove" PHP FUNCTION IS MADE PART OF CORE IN THE FUTURE ... Remove a specific element from the array. ... removing the wrong element when you remove something by the value, ... AFTER JAVA Vector.removeElementAt ...
    (comp.lang.php)