3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $supported_locales = "en_US,nl_NL"; $array = explode(',', $supported_locales); $array = array_map( function ($value) { list($key, $value) = explode('_', $value); return [$key => $value]; }, $array); print_r($array);
based on 8YdJU
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0rc3
Array ( [0] => Array ( [en] => US ) [1] => Array ( [nl] => NL ) )