Hello Readers ,
The array_fill_keys() function fills an array with values, specifying keys.
For Example we have an array array("a","b","c","d"); and we want to put "blue" in all values of a key. See the below example.
<!DOCTYPE html>
<html>
<body>
<?php
$keys=array("a","b","c","d");
$a1=array_fill_keys($keys,"blue");
print_r($a1);
?>
</body>
</html>
Output:
Array ( [a] => blue [b] => blue [c] => blue [d] => blue )
0 Comment(s)