3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
array ( 'McGross' => 10.17, 'ProtectionEligibility' => 'Eligible', 'AddressStatus' => 'unconfirmed', 'PayerId' => 'STTAC7UV2CVJ4', )

preferences:
67.26 ms | 402 KiB | 91 Q