3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'Test' => 1, 'OtherKey' => 2, ); $keyTranslation = array( 'OtherKey' => 'other_key', 'Test' => 'test', ); function test(&$arr, $keyTranslation) { foreach ($arr as $key => $value) { var_dump($key); $arr["'".$keyTranslation[$key]."'"] = $value; unset($arr[$key]); } } test($arr, $keyTranslation);

preferences:
57.39 ms | 402 KiB | 5 Q