php / 8.1.5 / function.trait-exists.html /

trait_exists

(PHP 5 >= 5.4.0, PHP 7, PHP 8)

trait_existsChecks if the trait exists

Description

trait_exists(string $trait, bool $autoload = true): bool

Parameters

trait

Name of the trait to check

autoload

Whether to autoload if not already loaded.

Return Values

Returns true if trait exists, and false otherwise.

© 1997–2021 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/function.trait-exists.php