3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function t($parent_key, $parent_array, &$data) { foreach ($parent_array as $k => $v) { if (is_array($v)) { t("${parent_key}_${k}", $v, $data); } else { $data[trim("${parent_key}_${k}", '_')] = $v; } } } $data = array(); $attributes = array( 'Users' => array( 'Name' => 'Name', ), 'Address' => 'Address', 'Tags' => array( 0 => array( 'Key' => 'Key', 'Value' => 'Value', ), 1 => array( 'Key' => 'Key', ), 2 => array( ) ), ); t('', $attributes, $data); print_r($data);
Output for 4.3.0 - 7.2.0
Array ( [Users_Name] => Name [Address] => Address [Tags_0_Key] => Key [Tags_0_Value] => Value [Tags_1_Key] => Key )