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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:10:49+00:00 2026-06-08T22:10:49+00:00

I have the following multidimensional array: Array ( [0] => Array ( [0] =>

  • 0

I have the following multidimensional array:

   Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [name] => team0
                    [games] => Array
                        (
                            [0] => 3
                        )

                )

            [1] => Array
                (
                    [name] => team1
                    [games] => Array
                        (
                            [0] => 2
                        )

                )

            [2] => Array
                (
                    [name] => team2
                    [games] => Array
                        (
                            [0] => 1
                        )

                )

            [3] => Array
                (
                    [name] => team3
                    [games] => Array
                        (
                            [0] => 0
                        )

                )

        )

I am trying to traverse through the array and store information from the array in individual variables to execute a queries on a database using these variables as parameters. I am finding working with this multidimensional array very confusing and I am struggling to understand how to properly iterate over the array. As it is, this is my code… which at this stage is more just me meddling with foreach loops, trying to grasp a better understanding of how I can achieve what I need to do. There is a problem with this code as it is, after every team name “Array” is also echoed out.

foreach ($arrTeam as $array) 
            foreach ($array as $groupid => $group){
                $in_groupID = $groupid+1;
                foreach ($group as $name) {
                    if (isset($name)) echo $name.'<br>'; 
                }                   
            }

Basically what I want to do is fetch a groupid and teamname from the array, store them in $in_groupID and $in_teamName, and then traverse deeper into the array and grab each game for that specific team one game at a time – executing the query on the database for each game I grab. The query itself is not a problem, it’s iterating through this confusing loop in the way that I want to and storing the values as parameters for the execution.

Any help would be majorly appreciated. As I said, I’m not concerned with executing the database query and whatnot, I can easily fix that and add it in later, I just need to get my head around storing the parameters from the loop for the execute.

Thanks a lot for any help.

  • 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-08T22:10:51+00:00Added an answer on June 8, 2026 at 10:10 pm

    Stephen, and what about next ?

       foreach ($someInitArr as $rootIndex => $arrTeam)
          foreach ($arrTeam as $teamid => $team) {
    
            $teamName = $team['name'];
            $teamID = $teamid + 1;
    
                foreach($team['games'] as $gameNumber => $gameValue)
                  // here yo can grab each game separately within the database already having $teamName and $teamID
    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multidimensional array with the following structure: teamMembers[teamMembers][0][Name]; teamMembers[teamMembers][0][Email]; teamMembers[teamMembers][1][Name]; teamMembers[teamMembers][1][Email]; etc.
All, I have the following array and function, which will create a multidimensional array
I have the following multidimensional array: Array ( [0] => Array ( [id] =>
Let's assume I have the following multidimensional array (retrieved from MySQL or a service):
Quick Question: I have the following array (multidimensional): Array ( [preorder] => 0 [data]
I have a multidimensional array as follows: Array( [0] => Array ( [name] =>
I have the following multidimensional array: Array ( [0] => Array ( [area] =>
I have create following string multidimensional array in java. which has top outer array
I have a multidimensional array called $songs , which outputs the following: Array (
I have the following multidimensional array: $userList = array( 0 => array('id' => 1000,

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.