php - Convert array of keys to associative array -
i have array of data so
[ 'one', 'two', 'three' ]
i need convert so
[ 'one' => 'one', 'two' => 'two' ]
i found out array_flip gives me
[ 'one' => 0, 'two' => 0, 'three' => 0 ]
what can there? clean php way this?
array_combine()
way go
$a = array('one', 'two', 'three'); $output = array_combine($a, $a);
Comments
Post a Comment