invert

Inverts the items of an Array.


Syntax


Parameters

  • Array subject - The Array to invert.


Result

  • Array - An Array containing all the item values of subject as item keys, and the corresponding keys as values. Duplicate values will replace one another. Only item values that are valid keys will be inverted.

Returns subject with item keys and values exchanged.