I have a json string, now i want it to become another string like an array and the $key is the same with $value
original string:
$input='
{
"label_values":[
"OK1","OK2","OK3"
]
}'
tried json_decode
$obj = json_decode($input);
$results = $obj->{'label_values'};
$result = implode(",", $results);
and $result export OK1,OK2,OK3
$key is the same with $value,i want it change to below example
Array(
"OK1"=>"OK1",
"OK2"=>"OK2",
"OK3"=>"OK3"
)
Any help is greatly appreciated