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.0 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
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:
32.87 ms | 1139 KiB | 8 Q