add toggle array function

Toggle an item in array. If array contains many such items, they will
be removed entirely. If you pass isSingle then only first one of them
will be removed.