- var_dump: documentation ( source)
- strpos: documentation ( source)
- mb_substr: documentation ( source)
- array_keys: documentation ( source)
- trigger_error: documentation ( source)
<?php
class Test{ const AB♥ = "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 ) {
$strpos = strpos( $target, $bad_char);
var_dump( $strpos,mb_substr( $target, $strpos,1));
if ($strpos !== FALSE) trigger_error( "'$bad_char' in '$target'" );
}