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)), fn($result, $key) => array_merge( $result, [$key => ucwords(str_replace(['_', '-'], ' ', $key))] ), [] ) );

preferences:
31.27 ms | 409 KiB | 5 Q