I have an array like this
array(
0 => "bar",
1 => "foo",
);
and I want output like this
array(
"bar" => "bar",
"foo" => "foo",
);
how can i achieve this?
I have an array like this
and I want output like this
how can i achieve this? |
||||
|
Actually works for non-numeric as well:
|
||||
|
gives Array ( [bar] => bar [foo] => foo ) |
|||
|
in case non numeric array simple logic of using value as key works
gives
and if its strict use answer above, would be faster i guess and clean code too. |
||||
|