PHP 8.5.0 Beta 2 available for testing

The Attribute attribute

(PHP 8)

Introduction

Attributes offer the ability to add structured, machine-readable metadata information on declarations in code: Classes, methods, functions, parameters, properties and class constants can be the target of an attribute. The metadata defined by attributes can then be inspected at runtime using the Reflection APIs. Attributes could therefore be thought of as a configuration language embedded directly into code.

Class synopsis

final class Attribute {
/* Constants */
const int TARGET_CLASS ;
const int TARGET_ALL ;
/* Properties */
public int $flags ;
/* Methods */
public __construct (int $flags = Attribute::TARGET_ALL)
}

Properties

flags

Table of Contents

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes

There are no user contributed notes for this page.

AltStyle によって変換されたページ (->オリジナル) /