Many newbies don't know how to fetch all the keys and its values from the multidimensional arrays; it is as easy as 1, 2, 3 :) ... lets take a look at the following example
This will be the out put
array(
"sencond_ele_arr_item1","sencond_ele_arr_item2","sencond_ele_arr_item3"
),
"third_ele"
);
foreach($array as $value) {
if (is_array($value)) {
foreach($value as $dig_value) {
echo "-->".$dig_value."
";
}
} else {
echo $value."
";
}
}
?>
This will be the out put
first_ele -->sencond_ele_arr_item1 -->sencond_ele_arr_item2 -->sencond_ele_arr_item3 third_ele




This comment has been removed by the author.
ReplyDelete