3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array ( 'name' => 'richard', 'email' => 'richard@gmail.com', 'address' => Array ( 'city' => 'paris', 'zip' => 12121 ), 'address1' => Array ( 'city' => 'paris', 'zip' => 12121 ), 'address3' => Array ( 'city' => 'paris', 'zip' => 12121 ) ); function list_keys($array) { $output = array(); foreach ($array as $k => $v) { if (is_array($v)) { foreach (list_keys($v) as $path) { $output[] = "$k.$path"; } } else { $output[] = $k; } } return $output; } print_r(list_keys($array));
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.23, 7.4.0 - 7.4.12, 8.0.0
Array ( [0] => name [1] => email [2] => address.city [3] => address.zip [4] => address1.city [5] => address1.zip [6] => address3.city [7] => address3.zip )