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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:06:44+00:00 2026-05-12T21:06:44+00:00

When In print_r or var_dump echo <pre>; echo var_dump($groupname); echo </pre>; I got the

  • 0

When In print_r or var_dump

echo "<pre>";
echo var_dump($groupname);
echo "</pre>";

I got the result

array(2) {
  [0]=>
  object(stdClass)#330 (1) {
    ["name"]=>
    string(3) "AAA"
  }
  [1]=>
  object(stdClass)#332 (1) {
    ["name"]=>
    string(3) "BBB"
  }
}

Now I want to got the result from the array.

AAA | BBB 
  • 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-12T21:06:44+00:00Added an answer on May 12, 2026 at 9:06 pm

    You might want to start out by looking on how arrays work. Also if you don’t know “what” an array is, look over this Wikipedia entry.

    Examples from PHP.NET

    Declare an indexes and values

    <?php
    $arr = array("foo" => "bar", 12 => true);
    
    echo $arr["foo"]; // bar
    echo $arr[12];    // 1
    ?>
    

    Here is another example with the results

    <?php
    // Create a simple array.
    $array = array(1, 2, 3, 4, 5);
    print_r($array);
    
    // Now delete every item, but leave the array itself intact:
    foreach ($array as $i => $value) {
        unset($array[$i]);
    }
    print_r($array);
    
    // Append an item (note that the new key is 5, instead of 0).
    $array[] = 6;
    print_r($array);
    
    // Re-index:
    $array = array_values($array);
    $array[] = 7;
    print_r($array);
    ?>
    

    Result of the above:

    Array
    (
        [0] => 1
        [1] => 2
        [2] => 3
        [3] => 4
        [4] => 5
    )
    Array
    (
    )
    Array
    (
        [5] => 6
    )
    Array
    (
        [0] => 6
        [1] => 7
    )
    

    Your special problem

    Now it looks to me that you want to select each name from each record / row in your array / list.

    To do this you need to loop / iterate throughout the array and write the current rows name-value.

    Example on looping with arrays

    <?php
    $people = Array(
            Array('name' => 'Kalle', 'salt' => 856412),
            Array('name' => 'Pierre', 'salt' => 215863)
            );
    
    for($i = 0; $i < sizeof($people); ++$i)
    {
        echo $people[$i]['name'];
    }
    ?>
    

    Doing this without loops

    So let’s say that you know that your array only has two values, well then if you had an array looking like this:

    $arr = array(10, 20);
    

    You could write something like this to write them out:

    echo $arr[0];
    echo $arr[1];
    

    Remember that when you tell your array which “row” to get, you always say “how many steps to go”, meaning that if you want the first value, you take 0 steps, therefore the index is… 0!

    Object orientation and arrays

    Since you are using an object in your array you might want to check out some information about PHP and Object Oriented Programming.

    Side note and a cool example

    See this cool example which might give you an idea on what you can do

    <?php
    
    $obj = (object) array('foo' => 'bar', 'property' => 'value');
    
    echo $obj->foo; // prints 'bar'
    echo $obj->property; // prints 'value'
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 219k
  • Answers 219k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can try something like this SELECT * FROM TABLE… May 12, 2026 at 11:42 pm
  • Editorial Team
    Editorial Team added an answer // Grab all files from the desired folder $files =… May 12, 2026 at 11:42 pm
  • Editorial Team
    Editorial Team added an answer Most of the work I do these days involves multi-threaded… May 12, 2026 at 11:42 pm

Related Questions

When I was in college i did some C/C++, but in near future i
When I first learned Python, I got used to doing this: print text, lineNumber,
When I use dns_get_record within a php script to get a list of DNS
I am using PHP 5's scandir($dir) function to iterate through a directory and print

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.