- substr: 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 = "♥";
$keys = array_keys( $rc->getConstants() );
$key = $keys[ 0 ];
$substr = substr( $key, -1,1 );
$substr = mb_substr( $key, -1,1 ); // 5.6
if ( $substr === $bad ) {
trigger_error( "'$bad' in '$key'" );
}
// notice appears