3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Generic { public static $propA = "A"; private static $propB = "B"; protected static $propC = "C"; public static function getProperty(string $property): string { if (!property_exists('Generic', $property)) : return "Undefined Property"; endif; return self::$$property; } } print_r(Generic::getProperty('propA')); echo "\n"; print_r(Generic::getProperty('somethingNotDefined'));

preferences:
24.04 ms | 405 KiB | 5 Q