php multidimensional array column code example
Example 1: php implode multidimensional array
$users = [
'users' => ['[email protected]','[email protected]'],
'admins' => ['[email protected]', '[email protected]']
];
function implodeArrayofArrays($array, $glue = ', ') {
$output = '';
foreach ($array as $subarray) {
$output .= implode($separator, $subarray);
}
return $output;
}
echo implodeArrayofArrays($users);
Example 2: how to create multidimensional array in php
$cars = array
(
array("Volvo",22,18),
array("BMW",15,13),
array("Saab",5,2),
array("Land Rover",17,15)
);