3v4l.org

run code in 300+ PHP versions simultaneously
<?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" ) { var_dump($t,mb_substr($t,-1,1,"utf-8"), "\xe2\x99\xa5"); echo "\n\xa5"; echo "&hearts;"; echo "&#x2665"; echo "&#9829"; echo '&#' . 0x2665; echo '&#' . 9829; echo "heart: ",json_decode('"' . "\u2665" . '"'); //trigger_error("heart symbol is disallowed",E_USER_ERROR); }
Output for 5.4.1 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
string(5) "AB♥" string(3) "♥" string(3) "♥" �&hearts;&#x2665&#9829&#9829&#9829heart: ♥

preferences:
211.42 ms | 404 KiB | 268 Q