I have an array of data like so
[
'one', 'two', 'three'
]
I need to convert it like so
[
'one' => 'one',
'two' => 'two'
]
I found out about array_flip which gives me
[
'one' => 0,
'two' => 0,
'three' => 0
]
What can I do from there? Any clean PHP way to do this?
array_combine()
is the way to go
$a = array('one', 'two', 'three');
$output = array_combine($a, $a);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments