PHP 8.5.0 RC 2 available for testing

The Attribute attribute

(PHP 8)

็ฎ€ไป‹

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.

็ฑปๆ‘˜่ฆ

final class Attribute {
/* ๅธธ้‡ */
/* ๅฑžๆ€ง */
public int $flags;
/* ๆ–นๆณ• */
public __construct(int $flags = Attribute::TARGET_ALL)
}

ๅฑžๆ€ง

flags

ๅ‚่ง

Attributes overview

็›ฎๅฝ•

๏ผ‹ๆทปๅŠ ๅค‡ๆณจ

็”จๆˆท่ดก็Œฎ็š„ๅค‡ๆณจ

ๆญค้กต้ขๅฐšๆ— ็”จๆˆท่ดก็Œฎ็š„ๅค‡ๆณจใ€‚
To Top