3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array('country1' => 'CountryOne', 'country2' => 'Country Two'); print_r($input); $output = array_map(function($each) { return array('code' => key($each), 'name' => current($each)); }, array_chunk($input, 1, true)); print_r($output); ?>

preferences:
87.41 ms | 408 KiB | 5 Q