3v4l.org

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

preferences:
55.66 ms | 405 KiB | 6 Q