PHP/trait

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< PHP
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

About

In PHP, a trait is a set of member-variables and method-functions which can be added to the declaration of any class.

The autoloader treats traits like classes.

Traits are used via one sense of the use keyword.

Functions

  • trait_exists(): returns TRUE if the trait has been declared in code that has executed.

There does not appear to be a function to detect if a given class or object uses a given trait.

Links