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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:33:57+00:00 2026-06-12T02:33:57+00:00

I have a problem with printing my data. In my program, i get the

  • 0

I have a problem with printing my data. In my program, i get the data which was in object and put in an array. say array1[$id] = dataobject. the whole array1 then will be put to array2[‘list’] like array2[‘list’] = array1;

the problem is how do i get the data such as the id, name and description.. here’s the print_r of the whole array:

this is actually the result of the array, i am not sure how to access this. i want to foreach and get the name and print them:

Array ( 
[list] => Array ( 
    [0] => Array ( 
        [0] => stdClass Object ( 
            [id] => 1 
            [name] => harry potter 4 
            [description] => harry potter and the goblet of fire book by j.k. rowling 
            [unit_price] => 300.99 
        ) 
    ) 
    [1] => Array (
        [0] => stdClass Object ( 
            [id] => 4
            [name] => lipton tea
            [description] => yellow label tea
            [unit_price] => 15.00 
        ) 
    ) 
    [2] => Array (
        [0] => stdClass Object (
            [id] => 9
            [name] => tisyu
            [description] => tissue twenty pieces
            [unit_price] => 20.00
        ) 
    )

) 

)
  • 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-12T02:33:59+00:00Added an answer on June 12, 2026 at 2:33 am

    You would have to access them something like the following:

    foreach($array['list'] as $array_item){
        $object = $array_item[0];
    
        echo $object->id."<br />";
        echo $object->name."<br />";
        echo $object->description."<br />";
        echo $object->unit_price."<br />";
    }
    

    This would yield:

    1
    harry potter 4
    harry potter and the goblet of fire book by j.k. rowling
    300.99
    4
    lipton tea
    yellow label tea
    15.00
    9
    tisyu
    tussue twenty pieces
    20.00
    

    You can access an objects properties using the -> operator, followed by the property you wish to access.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have little problem with printing data like this, I have written script like
I have a program which prints (by printf) to the stdout some data and
I have problem while loading data into html select when users press or click
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have no problem printing an Express shipping label. The ground shipping label doesn't
I have function which selects data from MySQL database: function get_articles( $id ){ global
Problem: Printing from within BIDS 2008 R2 Preview tab hangs and must have the
Coming from Question which was answered really quick, I have stumbled upon upgraded problem.
I have a PyQt4 program that I froze using cx_freeze. The problem I am
I have a multi-threaded Windows program which is doing serial port asynchronous I/O through

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.