- substr: documentation ( source)
- array_keys: documentation ( source)
- trigger_error: documentation ( source)
<?php
class Test{ const AB♥ = "alphabet"; }
$rc = new ReflectionClass("Test");
$bad = "♥";
$key = array_keys( $rc->getConstants())[0];
$substr = substr( $key, -1,1 );
//$substr = mb_substr( $key, -1,1 ); // 5.6
if ( $substr === $bad ) {
trigger_error( "'$bad' in '$key'" );
}
// Notice: '♥' in 'AB♥' ...