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;
}