php/php-src — pull request #23 by christopherobin (2012-03-28 08:49:29+00:00)
Title: Add function is_using to check if an object uses a given trait

Code is mainly a heavily modified version of is_a/is_subclass_of and provide a test.

# Documentation

## is_using

(PHP 5.4)

is_using — Checks if the object or class name is using this trait

### Description
> bool __is_using__ ( mixed _$object_ , string _$trait_name_ , bool _$allow_string_ = true );

Checks if the __object__ is using trait __trait_name__.

### Parameters
___object___

> A class name or an object instance

___trait___\____name___

> The trait name

___allow___\____string___

> Whether to call autoloader if the class doesn't exist

### Return Values
This function returns __TRUE__ if the object __object__, uses the trait __trait_name__, __FALSE__ otherwise.

## Examples

```php
The above example will output:
>
> ```
> yes, $FC is using Bar
> yes, $F is using Bar
> yes, Foo is using Bar
> no, Other is not using Bar
> ```
>