- ucwords: documentation ( source)
- var_export: documentation ( source)
- str_replace: documentation ( source)
<?php
$array = [
'mc_gross' => 10.17,
'protection_eligibility' => 'Eligible',
'address_status' => 'unconfirmed',
'payer_id' => 'STTAC7UV2CVJ4'
];
$result = [];
foreach ($array as $key => $value) {
$result[str_replace('_', '', ucwords($key, '_'))] = $value;
}
var_export($result);