3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum Suit: string { case Hearts = 'H'; case Diamonds = 'D'; case Clubs = 'C'; case Spades = 'S'; } $reflection = new ReflectionEnum('Suit'); if ($reflection->isBacked()) { echo $reflection->getBackingType(); } else { // consider as object }
Output for 8.1.0 - 8.1.34, 8.2.29 - 8.2.32, 8.3.5 - 8.3.32, 8.4.6 - 8.4.23, 8.5.0 - 8.5.8
string
Output for 8.0.22
Parse error: syntax error, unexpected identifier "Suit" in /in/dLRMX on line 3
Process exited with code 255.

preferences:
59.24 ms | 678 KiB | 4 Q