PHP 7.4.22 Released!

ReflectionClass::getModifiers

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getModifiersGets the class modifiers

Description

public ReflectionClass::getModifiers(): int

Returns a bitfield of the access modifiers for this class.

Parameters

This function has no parameters.

Return Values

Returns bitmask of modifier constants.

See Also

add a note add a note

User Contributed Notes 1 note

up
-8
Nicola Pietroluongo
6 years ago
It's the amount of memory allocation in bit.
By default many systems allocate 1048576 bit (1 Megabit).

/* Example 1 */

class Test {}
$classTest = new Test();
$reflectionClass = new \ReflectionClass('Test');
$classModifiers = $reflectionClass->getModifiers();
var_export($classModifiers);

//output
1048576

/* Example 2 */

class Test {}
//the constructor is missing
$reflectionClass = new \ReflectionClass('Test');
$classModifiers = $reflectionClass->getModifiers();
var_export($classModifiers);

//output
0
To Top