3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { static $modeMapping = array( 'bar' => 'Exception' ); public static function testing() { if (isset( self::$modeMapping[$mode] ) ) { return new self::$modeMapping[$mode]( ); } } } var_dump( Foo::testing() );

preferences:
53.8 ms | 402 KiB | 5 Q