php8.5
Home/ Manual/ classobj / functions/ trait_exists

trait_exists

PHP function Edit on GitHub ✎

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

Checks 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.

Source: reference/classobj/functions/trait-exists.xml · from the official PHP manual (php/doc-en)