figure out members of an object?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • www.douglassdavis.com

    figure out members of an object?



    Say I am retrieving an object from a function...

    The object really has no distinguishable type as far as my code can
    tell (It's from a SOAP function, the objects returned do not have
    different types).

    $client = new SoapClient("/geocoder.wsdl") ;

    // Retrieve the address coordinates
    $result = $client->geocode($addre ss);

    Now, there could be two "types" of objects returned, with two distinct
    sets of members.

    say one type has a member "prefix" and one has a member "prefix1"

    my question is, how can I figure out which type the function has
    returned? I don't think I can do isset( ) to test if a member exists.

  • NC

    #2
    Re: figure out members of an object?

    www.douglassdavis.com wrote:[color=blue]
    >
    > Say I am retrieving an object from a function...[/color]
    ....[color=blue]
    > Now, there could be two "types" of objects returned, with two distinct
    > sets of members.
    >
    > say one type has a member "prefix" and one has a member "prefix1"
    >
    > my question is, how can I figure out which type the function has
    > returned?[/color]

    Use get_object_vars () to obtain an associative array of defined object
    properties for the returned object. Alternetively, use get_class() to
    see the type of the returned object. For more information, see the
    Manual:


    Returns the name of the class of an object


    Cheers,
    NC

    Comment

    Working...