Page MenuHomePhorge

function array_fuse($list)
libphutil Technical Documentation (Core Utilities)

Simplifies a common use of array_combine(). Specifically, this:

COUNTEREXAMPLE:
if ($list) {
  $result = array_combine($list, $list);
} else {
  // Prior to PHP 5.4, array_combine() failed if given empty arrays.
  $result = array();
}

...is equivalent to this:

$result = array_fuse($list);
Parameters
list$listList of scalars.
Return
dictDictionary with inputs mapped to themselves.