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 7853895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:50:42+00:00 2026-06-02T19:50:42+00:00

My Array consist: Array ( [**Anconia**] => Array ( [1335372330] => 7 [1335190784] =>

  • 0

My Array consist:

Array ( 
      [**Anconia**] => Array ( [1335372330] => 7 [1335190784] => 7 [1334883979] => 7 [1334672871] => 7 [1334539093] => 7 [1334337930] => 7 [1334189033] => 7 [1334007668] => 7 [1333567097] => 7 [1332973327] => 7 [1332533799] => 7 [1332215655] => 7 [1331697329] => 7 [1331239651] => 7 [1331075294] => 7 [1330983800] => 7 [1330658201] => 7 [1330484662] => 7 [1330202828] => 7 [1330028992] => 7 ) 
      [**Angellica**] => Array ( [1335372330] => 9 [1335190784] => 9 [1334883979] => 10 [1334539093] => 10 [1334337930] => 10 [1334189033] => 10 [1334007668] => 10 [1331697329] => 9 [1331239651] => 9 [1331075294] => 9 [1330983800] => 9 [1330658201] => 10 [1330484662] => 10 [1330202828] => 8 [1330028992] => 9 )
)

TimeStamp    Tally Number
[1335372330] => 7

Using foreach confused me when attempting to extract this. Want to print the NAME (print in bold) once and display the timestamp = how many.

How would I go about that?

Thanks in advance!

EDIT:

my attempt

foreach($results as $k => $v) { 
   $THEAD .= "<th scope='col'>".$k."</th>"; 
   $TBODY .= "<tr><th scope='row'>".$v."</th>"; 
   $TBODY2 .= "<td>".$results[$k]."</td>"; 
}
  • 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-06-02T19:50:45+00:00Added an answer on June 2, 2026 at 7:50 pm

    In general, you can loop through a nested array the same way as you loop through a single-level array. Example:

    $myArray = array(
        'first-level-first-key' => array(
            'second-level-first-key' => 'some value',
            'second-level-second-key' => 'another value'
        ),
        'first-level-second-key' => array(
            'seond-level-another-key' => 'yet another value'
        )
    );
    
    foreach($myArray as $first_level_key => $first_level_value) {
        echo 'Key: '. $first_level_key .'<br />';
        echo 'Values: ';
        foreach($first_level_value as $second_level_key => $second_level_value) {
            echo $second_level_value .', ';
        }
        echo '<br /><br />';
    }
    

    This will print out:

    Key: first-level-first-key
    Values: some value, another value,
    
    Key: first-level-second-key
    Values: yet another value,
    

    Now you know how to loop through nested arrays. Have fun!

    Edit

    A little bit more explanation, as an answer to tmyie’s comment below:
    As you can see every element is an array in itself:

    $myArray['first-level-first-key'] = array('second-level-first-key' => ... );
    

    The first foreach loops through all the ‘first-level’ arrays (in my example the elements with key ‘first-level-….’). So within that loop, the variable $first_level_value holds an array. The second foreach loops through that, second-level, array. This nesting of loops is virtually endless if you have saved yet another array in that second level element.

    Compare it with having a couple of boxes in front of you. With the first loop, you say ‘Open up every box in front of me’. Then for every single box you have opened, the nested loop says ‘Open up every box I found in that box’, and so on.

    Although there is most probably something very wrong with your application design if you’d write this, the following example is completely valid:

    foreach($myArray as $x) {
        foreach($x as $y) {
            foreach($y as $z) {
                foreach($z as $p) {
                    // etc
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am bit confused about how Java handle conversion. I have char array consist
I'm trying to create an array of bar objects in php which consist of
I have a vector array of triangles which basically consist of a bunch of
I got this multiple array named $files[] , which consists of keys and values
I have a multi-dimensional array, which basically consists of one sub-array for each year.
Array.Copy and Buffer.BlockCopy both do the same thing, but BlockCopy is aimed at fast
Array ( [4] => stdClass Object ( [vid] => 4 [name] => Movie [description]
Array ( [status] => success [stories] => Array ( [0] => Array ( [name]
Array ( [0] => Array ( [datas] => Array ( [name] => lorem [id]
Array starts like this: Array ( [SMART Board] => Array ( [0] => sb1

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.