Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6821571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:33:38+00:00 2026-05-26T21:33:38+00:00

I have a bit of difficulty creating some tables in a specific order from

  • 0

I have a bit of difficulty creating some tables in a specific order from this array: $test.

The array looks like this:

Array
(
    [ET5] => Array(
        [0] => Array(
            [0] => Array(
                [total] => 430
            )
        )
        [1] => Array(
            [0] => Array(
                [total] => 406
            )
        )
    )
    [FA] => Array(
        [0] => Array(
            [0] => Array(
                [total] => 0
            )
        )                   
        [1] => Array(
            [0] => Array(
                [total] => 0
            )
        )
    )
    [ET5] => Array(
        [0] => Array(
            [0] => Array(
                [total] => 189
            )
        )
        [1] => Array(
            [0] => Array(
                [total] => 228
            )
        )
    )
    [FA] => Array(
        [0] => Array(
            [0] => Array(
                [total] => 0
            )
        )
        [1] => Array(
            [0] => Array(
                [total] => 0
            )
        )
    )
)

and the tables I want to create should look like this:

table1

test1      test2   test3
ET5        430     189
FA         0       0

table2

test1      test2    test3
ET5        406      228
FA         0        0

test1, test2, test3 are known strings

I’m a bit stuck on this one, notice how the values from the ET5 are in two tables.

Any ideas on this one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:33:39+00:00Added an answer on May 26, 2026 at 9:33 pm

    You should definitely not overwrite the keys of the array like you do above.

    I would separate what you want in each tables by adding them as arrays to your already multi-dimensional array…

    $test = array(
        [0] => array(
            [ET5] => array(), //rest of inner contents inside these arrays of course
            [FA] => array()
        ),
        [1] => array(
            [ET5] => array(),
            [FA] => array()
        )
    );
    

    then run your foreach loop as you would on any array:

    <?php foreach($test AS $key => $val): ?>
    <table>
        <tr>
            <th>Test1</th>
            <th>Test2</th>
            <th>Test3</th>
        </tr>
        <?php foreach($val AS $v => $info): ?>
        <tr>
            <td><?php echo $v; ?></td>
            <td><?php echo $info[0][0]['total']; ?></td>
            <td><?php echo $info[1][0]['total']; ?></td>
        </tr>
        <?php endforeach; ?>
    </table>    
    <?php endforeach; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a bit of difficulty with this current code I have set
I have had a bit of a look around and am having some difficulty
I have the following bit of code that I am having some difficulty with.
I have this bit of javascript written with jQuery 1.2.5. It's contained inside the
I have a bit of html like so: <a href=#somthing id=a1><img src=something /></a> <a
I have this bit of script to widen a text box on mouseover and
like two guys before me there and second one there I have difficulty with
I'm having a bit of difficulty using the values in a PHP array for
I'm having a bit of difficulty with some java code class foo{ public bar()
I have a large array with 1024 entries that have 7 bit values in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.