Issue
im trying to get the type of the object that i receive in the constructor using gettype($this->object)
.
but im only getting "object" my constructor: p
public function __construct($object=null)
{
$this->object=$object;
}
the object that i send to class:
$campaign = new Campaign();
$type = new Nodes\CampaignDatabaseNode($campaign);
$type->checkType();
the checkType(); only echo the type of the object
Solution
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()
).
Answered By - madsen
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.