I have an array like this
[
123456 => 'John Doe'
654321 => 'Doe John'
]
I want to change the array key (123456 and 654321) into an index (0,1,2,3,....,n) and save it into value, the expected result looks like this
array(
0 => array(
'name' => 'John Doe',
'code' => 123456.
),
1 => array(
'name' => 'Doe John',
'code' => 654321.
),
)
this is the code i have tried, i have only gotten so far
$thearray= array_map(function ($value, $key) {
return $key;
}, $thearray, array_keys($thearray));