php update value in multidimensional array code example
Example: php implode multidimensional array
$users = [
'users' => ['[email protected]','[email protected]'],
'admins' => ['[email protected]', '[email protected]']
];
// function to convert array of arrays to string
function implodeArrayofArrays($array, $glue = ', ') {
$output = '';
foreach ($array as $subarray) {
$output .= implode($separator, $subarray);
}
return $output;
}
echo implodeArrayofArrays($users);
// "[email protected], [email protected], [email protected], [email protected]"