3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo extends \IntlCalendar { } $fooReflection = new \ReflectionClass(\Foo::class); $intlGregorianCalendarReflection = new \ReflectionClass(\IntlGregorianCalendar::class); printf("%d constants in %s, ", count($fooReflection->getConstants()), \Foo::class); if ($fooReflection->getParentClass()) { printf("%s extends %s\n", Foo::class, $fooReflection->getParentClass()->getName()); } printf("%d constants in %s, ", count($intlGregorianCalendarReflection->getConstants()), \IntlGregorianCalendar::class); if ($intlGregorianCalendarReflection->getParentClass()) { printf("%s extends %s\n", \IntlGregorianCalendar::class, $intlGregorianCalendarReflection->getParentClass()->getName()); } printf("%d constants in %s\n", count((new \ReflectionClass(\IntlCalendar::class))->getConstants()), \IntlCalendar::class);
Output for 7.1.20 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.28, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
39 constants in Foo, Foo extends IntlCalendar 39 constants in IntlGregorianCalendar, IntlGregorianCalendar extends IntlCalendar 39 constants in IntlCalendar
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.8
39 constants in Foo, Foo extends IntlCalendar 0 constants in IntlGregorianCalendar, IntlGregorianCalendar extends IntlCalendar 39 constants in IntlCalendar