This question already has an answer here:
I have this array:
$a = array('b', 'c', 'd');
Is there a simple method to convert the array to the following?
$a = array('b' => 'b', 'c' => 'c', 'd' => 'd');
</div>
This question already has an answer here:
I have this array:
$a = array('b', 'c', 'd');
Is there a simple method to convert the array to the following?
$a = array('b' => 'b', 'c' => 'c', 'd' => 'd');
</div>
$final_array = array_combine($a, $a);
P.S.
* Be careful with similar values. For example:
array('one','two','one')
may be problematic if converted like duplicate keys:
array('one'=>..,'two'=>..,'one'=>...)