How do I Store an Array Variable Inside of Another Array Variable using while loop and for each?
Asked
Active
Viewed 213 times
0
-
Please go read [ask]. – CBroe Jun 08 '17 at 09:27
-
Your question is confusing. If you want to print an array you can use print_r($array). Please be clear with your question – teshvenk Jun 08 '17 at 09:29
-
I want to print array like in image which i have upload in question – Jigu Jun 08 '17 at 09:31
-
https://i.stack.imgur.com/fu2nn.jpg This is the output – Jigu Jun 08 '17 at 09:31
2 Answers
1
please chec Foreach for arrays inside of an array
foreach($resultArray as $row => $innerArray){
foreach($innerArray as $innerRow => $value){
echo $value . "<br/>";
}
}
also check this link : Foreach for arrays inside of an array

Hardik Chapla
- 435
- 6
- 26
0
You are probably looking for
<?php
$format = array('Roman' => array('one'=>'I','two'=>'II'),
'Arbic' => array('one'=>'1','two'=>'2'));
while (list($key, $value) = each($format)) {
echo $value;
foreach( $key as $key1 => $value1) {
echo $key1 .'='.$value1;
}
?>
I have not tested .

Suraj Khanra
- 480
- 1
- 5
- 23
-
I have shared this answer to print your array using while and foreach loop – Suraj Khanra Jun 08 '17 at 10:05