class_implements

(PHP 5)

class_implements --  Return the interfaces which are implemented by the given class

Description

array class_implements ( mixed class [, bool autoload] )

This function returns an array with the names of the interfaces that the given class implements.

Parameters

class

An object (class instance) or a string (class name).

Return Values

Returns an array or FALSE on error.

ChangeLog

VersionDescription
5.1.0 Added the option to pass the parameter as a string

Examples

Example 1. class_implements() example

<?php

interface foo
{ }
class
bar implements foo {}

print_r(class_implements(new bar));

?>

The above example will output:

Array
(
    [foo] => foo
)

See Also

class_parents()