I have a JSON object I've turned into an array, this needs to be stored into my database, the trouble is my table has field called id, however in the array it's called group_id.
What's the most efficient way of traversing my multi-dimensional array converting all the group_id keys to id so I can pass it to my SQL storage function? I want to function to work with an array or an array or arrays.
I had planned to make a function:
$db->remap($array, [ 'group_id' => 'id' ]; then I can pass a list of all the fields I want remapping.
array_walk_recursive doesn't help because it won't let you modify the keys, I looked at a recursive function call, but struggled to keep track of the array.