I am trying to convert the keys of a multi-dimensional array from CamelCase to snake_case, with the added complication that some keys have an exclamation mark that I'd like removed.
For example:
$array = array(
'!AccountNumber' => '00000000',
'Address' => array(
'!Line1' => '10 High Street',
'!line2' => 'London'));
I would like to convert to:
$array = array(
'account_number' => '00000000',
'address' => array(
'line1' => '10 High Street',
'line2' => 'London'));
My real-life array is huge and goes many levels deep. Any help with how to approach this is much appreciated!