> -----Original Message-----
> From: John Comerford [mailto:[EMAIL PROTECTED]
> Sent: 27 April 2007 08:41
> To: php-general@lists.php.net
> Subject: [PHP] Find a what class a variable is
>
>
> Hi Folks,
>
> Is is possible to detect what class a variable is eg.
>
> $JC1 = new Button();
> $JC2 = new TickBox();
>
>
> Is it possible to find out what class $JC1 is ?
>
> TIA,
>   JC

If you want check it is of a certain type, use the instanceof operator, e.g.

if ($JC2 instanceof TickBox)
        echo '$JC2 is a TickBox';
else
        echo '$JC2 is not a TickBox';

E

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to