3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ["one" => 1, "two-two" => 2, "four" => 4], ["two-two" => 22, "three" => 33, "four" => 44] ]; var_export( array_reduce( array_keys(array_merge(...$array)), function($result, $key) { $result[$key] = ucwords(str_replace(['_', '-'], ' ', $key)); return $result; } ) );

preferences:
32.37 ms | 409 KiB | 5 Q