class_exists() With Enums¶
<?php
enum MyEnum {}
class_exists(MyEnum::class); // true or false?
In PHP, there are dedicated functions to check the availability of structures:
class_exists()trait_exists()interface_exists()enum_exists()
What would the code here produce?
This is displaying true. Enumerations are considered as classes, even as they have specific limitations and behavior, compared to normal classes.
See Also¶
PHP Features¶
Last updated: 14 July 2026