- mb_substr: documentation ( source)
- array_keys: documentation ( source)
- trigger_error: documentation ( source)
<?php
class Test{ const AB♥ = "alphabet"; }
$rc = new ReflectionClass("Test");
$t = array_keys( $rc->getConstants())[0];
if ( mb_substr($t,-1,1,"utf-8") == "\xe2\x99\xa5" ) {
trigger_error("heart symbol is disallowed",E_USER_ERROR);
}