Difference between revisions of "PHP/trait"
< PHP
		
		
		
		Jump to navigation
		Jump to search
		|  (Created page with "==About== In PHP, a '''trait''' is a set of member-variables and method-functions which can be added to the declaration of any {{l/same|class}}. ==Links== * Official: [htt...") | |||
| Line 1: | Line 1: | ||
| ==About== | ==About== | ||
| In [[PHP]], a '''trait''' is a set of member-variables and method-functions which can be added to the declaration of any {{l/same|class}}. | In [[PHP]], a '''trait''' is a set of member-variables and method-functions which can be added to the declaration of any {{l/same|class}}. | ||
| + | ==Functions== | ||
| + | * [https://www.php.net/manual/en/function.trait-exists.php 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== | ==Links== | ||
| * Official: [https://www.php.net/manual/en/language.oop5.traits.php traits] | * Official: [https://www.php.net/manual/en/language.oop5.traits.php traits] | ||
Revision as of 17:04, 29 September 2019
About
In PHP, a trait is a set of member-variables and method-functions which can be added to the declaration of any class.
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
- Official: traits