array_fill_keys

It fills an array with values, specifying keys

Example

<?php
echo “<pre>”;
$keys = array(‘PHP’, VB, ASP, ‘JSP’);
$a = array_fill_keys($keys, ‘WEB’);
print_r($a);
?>

Output

Array
(
[PHP] => WEB
[VB] => WEB
[ASP] => WEB
[JSP] => WEB
)

Share