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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:37:05+00:00 2026-06-17T15:37:05+00:00

Hi friends i am new to php , and i am trying to learn

  • 0

Hi friends i am new to php , and i am trying to learn classes
i am trying the following code with which i get all functions *name* described in the class
can anybody tell me how can i print the output of functions in the class

<?php
    class dog {
                    public function bark() {
                    print "Woof!\n";
                    }

                    public function legs() {
                    print "four!\n";
                    }
             }

    class poodle extends dog {
      public function yip() {
            print "Yipppppppp!\n";
        }
    }

    $poppy = new poodle;

    //$poppy->bark();
    $class_methods = get_class_methods(new poodle());
    //echo    $class_methods;
        foreach($class_methods as $class_methods1)
        {
        echo $class_methods1.'<br/>';
        }

?> 
  • 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-17T15:37:07+00:00Added an answer on June 17, 2026 at 3:37 pm

    This should work:

    $poodle = new poodle();
    $class_methods = get_class_methods($poodle);
    //echo    $class_methods;
    foreach($class_methods as $class_method)
    {
        echo $class_method.'\'s Output: '.$poodle->$class_method()."<br />"; 
    }
    

    In general:

    If you have a value like $test = "abc" you can evaluate it (in php) to either a variablename, or a function etc.:

    $test = "abc";
    $test() // equal to abc() - if function abc exists.
    
    echo $$test // equal to echo $abc - if $abc is defined.
    
    $anotherTest = new $test(); // equal to new abc() - if class exists.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Facebook php-sdk to get the users name and friends, right now
I'm new to wordpress and PHP, and after a while trying to code a
Hi i am new in using facebook api i want to get the friends
First i would like to thanks all friends,i got one case which made my
I am new to jquery & autocomplete, and am trying to learn them. The
I'm new to Facebook API and I'm currently trying to get the user friend
I am very new to PHP & MySQL. Just designing websites for friends as
What I'm trying to do is a counter of facebook friends in php, so
hello friends i am trying to get a list of user id and want
I've got a public List<FriendProfile> friends = new ArrayList<FriendProfile>(); . I initialize the friends

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.