Exchanges all keys of current array with their associated values.

/**
 * Exchanges all keys of current array with their associated values.
 *
 * @return self Returns instance of The Arrays class.
 */
public function flip(): self

Examples

$arrays = Arrays::create(['oranges', 'apples', 'pears'])->flip()->toArray();

print_r($arrays);

The above example will output:

Array
(
    [oranges] => 0
    [apples] => 1
    [pears] => 2
)

Getting Started

Methods