3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tests { const ELEMENTS = []; public function __construct() {} public static function test( $element ) { if ( empty( static::ELEMENTS[ $element ] ) ) { return false; } return true; } } var_dump( Tests::test( 'example' ) );
Output for 7.0.0, 8.1.23 - 8.1.29, 8.2.10 - 8.2.23, 8.3.0 - 8.3.11
bool(false)
Output for 5.6.40
Notice: Undefined index: example in /in/vqKpS on line 9 bool(false)

preferences:
63.13 ms | 406 KiB | 5 Q