The fillKeys() method fills an array with the static value, using the values of the array as keys.
<?php use kim\present\utils\arrays\ArrayUtils; $arrayUtils = ArrayUtils::from(["first", "second", "third"]); //Fill keys with 0 $arrayUtils->fillKeys(0); // expected output: ["first" => 0, "second" => 0, "third" => 0]
$arrayUtils->fillKeys(mixed $value) : ArrayUtils;
$value
Value to fill the array with.
A filled array.
$arrayUtils->fillKeysAs(mixed $value) : array;
ArrayUtils::fillKeysFrom(iterable $from, mixed $value) : ArrayUtils;
ArrayUtils::fillKeysFromAs(iterable $from, mixed $value) : array;
Last updated 4 years ago