Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 4 of 4

Thread: Describe what instance of a class a PHP object is?

  1. #1

    Describe what instance of a class a PHP object is?

    PHP isn't my strong point. I have more of an AS3 background. Personally, I hate how untyped PHP is.

    Does anyone know if there is any way to output, either as a String or a class object what class an object passed in belongs to?


    AS3 has object.constructor or describeType(object)
    Blog article of the month: Why My One Line 'if' Statements Are Unusual
    Twitter: @IQAndreas
    GitHub: IQAndreas

  2. #2
    http://php.net/manual/en/function.gettype.php <- A function to get an objects type(not a good function to use the is_? functions are better)

    http://www.php.net/manual/en/language.oop5.php <- Guide to understanding the backwards oop of php.

    http://php.net/manual/en/book.reflection.php <- This is a collection of classes for hacking objects.

  3. #3
    Fantastic. You saved me. It really helped me debugging, and now it's working like a charm.

    Just curious, when "gettype" returns "object", does that mean it only extends the object class or is an instance of the object class, or does it mean "Well, it's not a number, int, uint, or String, so I guess it's just some sort of object"?
    Blog article of the month: Why My One Line 'if' Statements Are Unusual
    Twitter: @IQAndreas
    GitHub: IQAndreas

  4. #4
    Quote Originally Posted by IqAndreas View Post

    Does anyone know if there is any way to output, either as a String or a class object what class an object passed in belongs to?


    AS3 has object.constructor or describeType(object)
    get_class($instance_variable) will return the class name to which the $instance_variable belongs to :-)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012