3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test{ const AB♥ = "alphabet"; } $rc = new ReflectionClass("Test"); $bad = "♥"; $key = array_keys( $rc->getConstants())[0]; $substr = substr( $key, -1,1 ); //$substr = mb_substr( $key, -1,1 ); // 5.6 if ( $substr === $bad ) { trigger_error( "'$bad' in '$key'" ); } // Notice: '♥' in 'AB♥' ...

preferences:
36.18 ms | 402 KiB | 5 Q