3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum TestEnum: string { /** Description about Case. */ case ABC = 'abc'; case XYZ = 'xyz'; /** @var string */ public const QWERTY = 'qwerty'; } $reflectionClass = new ReflectionClass(TestEnum::class); var_dump($reflectionClass->getProperties()[0]->getDocComment()); var_dump($reflectionClass->getProperties()[1]->getDocComment()); var_dump($reflectionClass->getReflectionConstants()[0]->getDocComment()); var_dump($reflectionClass->getReflectionConstants()[1]->getDocComment()); var_dump($reflectionClass->getReflectionConstants()[2]->getDocComment());

preferences:
21.04 ms | 474 KiB | 4 Q