how to print multidimensional array in php using for loop code example
Example 1: php foreach through multidimensional array
foreach ($rows as $row) {
echo $row['id'];
echo $row['firstname'];
echo $row['lastname'];
}
Example 2: create multidimensional array php for loop
$result = array();
foreach($members as $member) {
$result[] = array(
'firstname' => $member['firstname'],
'last_name' => $member['last_name'],
'job' => $member['job'],
'desc' => $member['desc'],
'image_url' => $member['image_url']
);
}