get type in php returns “object” and not the object type

Just to explain why gettype() doesn’t work as expected since others have already provided the correct answer. gettype() returns the type of variable — i.e. boolean, integer, double, string, array, object, resource, NULL or unknown type (cf. the gettype() manual link above).

In your case the variable $campaign is an object (as returned by gettype()), and that object is an instance of the class Campaign (as returned by get_class()).

Leave a Comment