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