PHP: set all values in an array to something
You can use array_fill_keys
:
$array = array(
1 => 231,
2 => 432,
3 => 324
);
$array = array_flip($array);
$array = array_fill_keys(array_keys($array), 1);
array_fill_keys() should be what you need:
$keys = array_keys($yourArray);
$filled = array_fill_keys($keys, 1);