Re: [PHP5] Interface implementation checking

From: Date: Mon, 27 Sep 2004 09:02:10 +0000
Subject: Re: [PHP5] Interface implementation checking
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-197935@lists.php.net to get a copy of this message
Marcin Paździora wrote:
Hi! I'd like to ask if there is any way of checking if a class implements given interface? Manual seems to be out of date on the subject.
instanceof PHP 5 introduces the instanceof keyword, that allows you to ascertain whether or not an object is an instance of a class, or extends a class, or implements an interface. <?php class baseClass { } $a = new baseClass; if ($a instanceof baseClass) { echo "Hello World"; } ?>

« previous php.general (#197935) next »