← All docs

trait_exists()

Checks whether the trait exists.

trait_exists()

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

Checks whether the trait exists.

Parameters:

  • $trait (string)
  • $autoload (bool), default true, optional

Returns: bool

Availability

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how trait_exists is implemented in the compiler, see the internals page.