function array_fuse($list)libphutil Technical Documentation (Core Utilities)
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 | $list | List of scalars. |
Return
dict | Dictionary with inputs mapped to themselves. |
- Defined
- src/utils/utils.php:957