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