PHP: Convert an array to a hash

I have a flat array that I want to convert to a hash so I can use it as a lookup table. There isn't an easy or clear way to do that in PHP so I wrote my own function:

function array_to_hash(array $array, $val = 1) {
    $ret = array_fill_keys($array, $val);

    return $ret;
}


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 44.211.58.249
To prevent spam please submit by clicking the kitten: