- mb_strpos: documentation ( source)
- array_keys: documentation ( source)
- trigger_error: documentation ( source)
<?php
class Test{ const ABC♥ = "alphabet"; }
$class = new ReflectionClass("Test");
$bad_char = "♥";
$constants = $class->getConstants();
$keys = array_keys($constants);
for ( $i=0, $max=count($keys); $i < $max; $i++) {
if ( mb_strpos( $keys[$i], $bad_char) !== false ) {
trigger_error( "'$bad_char' in '$keys[$i]" );
}
} // Notice: '♥' in 'ABC♥' ...