array_diff provides a handy way of deleting array elements by their value, without having to unset it by key, through a lengthy foreach loop and then having to rekey the array.
<?php
//pass value you wish to delete and the array to delete from
function array_delete( $value, $array)
{
$array = array_diff( $array, array($value) );
return $array;
}
?>