Table of Contents

# $EPIC: delitems.txt,v 1.2 2007/02/27 04:57:37 jnelson Exp $

Synopsis:

$delitems(<array> <item#> [<item#> …])

Technical:

This function is used to delete multiple entries from an array created with $setitem(). If the items you delete are all of the items in the array, the array is deleted too. For any item you delete from the array, all items beyond it (with higher item numbers) are shifted down by one to fill in the gap.

This puts the array into “unsorted mode” which means the overhead associating with re-sorting the array doesn't happen until the next time you try to get an item. This makes it more efficient than delitem in a loop.

Practical:

This function is used to delete multiple items from an array. The uses for this are pretty obvious. If you add items to an array, it follows that you might want to remove them, too.

Returns:

   -2   if the item does not exist in the array
   -1   if the array does not exist
    0   on success

Examples:

$delitem(array 2)             deletes item 2 from array "array"
$delitem(fake_array 4)        error, "fake_array_ does not exist
$delitem(array -2)            error, item -2 does not exist