0

How do I Store an Array Variable Inside of Another Array Variable using while loop and for each?

Like this(array inside array)

4
  • Please go read How to Ask. Commented Jun 8, 2017 at 9:27
  • Your question is confusing. If you want to print an array you can use print_r($array). Please be clear with your question Commented Jun 8, 2017 at 9:29
  • I want to print array like in image which i have upload in question Commented Jun 8, 2017 at 9:31
  • i.sstatic.net/fu2nn.jpg This is the output Commented Jun 8, 2017 at 9:31

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

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 .

1 Comment

I have shared this answer to print your array using while and foreach loop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.