flip()
The flip() method exchanges all keys with their values in an array
<?php
use kim\present\utils\arrays\ArrayUtils;
$arrayUtils = ArrayUtils::from(["a", "b", "c", "d"]);
//General usage
$arrayUtils->flip();
// expected output: ["a" => 0, "b" => 1, "c" => 2, "d" => 3]Syntax
$arrayUtils->flip() : ArrayUtils;Return value
A flipped array on success and
NULLon failure.
Prefixing
$arrayUtils->flipAs() : array;ArrayUtils::flipFrom(iterable $from) : ArrayUtils;ArrayUtils::flipFromAs(iterable $from) : array;References
Last updated