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

  • Home
  • SEARCH
  • 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 8381745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:45:47+00:00 2026-06-09T16:45:47+00:00

Having problems getting the right data out of this multidimensional(?) array that I retrieve

  • 0

Having problems getting the right data out of this multidimensional(?) array that I retrieve when using FirePHP to see what I’m working with:

array(
    ['day'] => 'Wed'
    ['is_used'] => 1
    [0] =>
    array(
        ['day'] =>
        'Wed'
        ['title'] =>
        'onsdag denna veckan 2'
        ['content'] =>
        ['price'] =>
    )
    [1] =>
    array(

        ['day'] =>
        'Wed'
        ['title'] =>
        'onsdagslunchen'
        ['content'] =>
        ['price'] =>
        123123
    )
)

I want to use the 0, 1 array in the array if that makes any sense…? Or is this array broken?

When I try

foreach ($foo as $bar){
    echo $bar
}

I’m getting 4 results, day, is_used and the 0, 1 arrays.

  • 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-09T16:45:49+00:00Added an answer on June 9, 2026 at 4:45 pm

    The code is returning the values correctly. It’s returning the first children of the $foo array, which are:

    day
    is_used
    0
    1
    

    day and is_used are strings, but because 0 and 1 are arrays, you’ll need to cycle through them again to get their values:

    foreach ($foo as $fooKey=>$bar){
        if(is_array($bar))
            // cycle through the array
            foreach ($bar as $key=>$value)
                // Echo out the string of the array
                echo "$fooKey $key = $value<br />";
            }
        } else {
            // Echo out the string
           echo "$fooKey = $bar<br />";
        }
    }
    

    That should echo out the following:

    day = Wed
    is_used = 1
    0 day = Wed
    0 title = onsdag denna veckan 2
    0 content =
    0 price =
    1 day = Wed
    1 title = onsdagslunchen
    1 content =
    1 price = 123123
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working to create an autosuggest and am having problems getting the data to
I'm having problems getting my rsync syntax right and I'm wondering if my scenario
I am having problems getting the TextWrapping to work in this example. Can anyone
I am having problems getting validation to work for a form built using Zend_Form.
I'm having a right barney getting my head around how everything fits together using
I'm a novice/beginner programmer having problems getting some simple client/server C code working. My
I'm having problems deserializing some json data, getting InvalidCastExceptions and the like. Can anyone
Im having problems getting at the HTML5 video tag with jQuery. Here is my
I am having problems getting my main content div to stretch to full height,
I am having problems getting JBoss to inject an environment variable value into a

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.