function my_remove_array_item( $array, $item ) { $index = array_search($item, $array); if ( $index !== false ) { unset( $array[$index] ); } return $array; }
$items = array( 'first', 'second', 'third'); $items = my_remove_array_item( $items, 'second' ); // remove item called 'second'