- 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, $ct=count($keys); $i < $ct; $i++) {
$target = $keys[ $i ];
//php5.6: if ( mb_substr( $target, -1,1) == $bad_char ) {
if ( strpos( $target, $bad_char) !== FALSE ) {
trigger_error( "'$bad_char' in '$target'" );
}}