AFAIK, there are no core PHP methods which allow you to re-key an array.
Okay, that's not entirely true - there is array_change_key_case()
, but whenever I need to change an array's keys it's never been this use case.
You could do it with a foreach
loop:
$newArray = [];