- 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)
<?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' ) );