get_declared_traits

(Ingen versionsoplysninger tilgængelige, findes måske kun i SVN)

get_declared_traitsReturns an array of all declared traits

Beskrivelse

array get_declared_traits ( void )

Parametre

This function has no parameters.

Returnerings Værdier

Returns an array with names of all declared traits in values. Returns NULL in case of a failure.

Se også

add a note add a note

User Contributed Notes 1 note

up
2
@everaldofilho
4 years ago
Example of use:

<?php

namespace Example;

// Declare Trait
trait FooTrait
{
}

// Declare Abstract class
abstract class FooAbstract
{
}

// Declare class
class Bar extends FooAbstract
{
    use
FooTrait;
}

// Get all traits declareds
$array = get_declared_traits();

var_dump($array);
/**
* Result:

* array(1) {
*  [0] =>
*  string(23) "Example\FooTrait"
* }
*/
To Top