fork download
  1. <?php
  2.  
  3.  
  4. function my_character2numeric($t)
  5. {
  6. $convmap = array(0x0, 0x2FFFF, 0, 0xFFFF);
  7. return str_replace(array("&#", ";"), array("\\u", ""), mb_encode_numericentity($t, $convmap, 'UTF-8'));
  8. }
  9.  
  10. echo my_character2numeric("жопа");
  11. ?>
Success #stdin #stdout 0.04s 25828KB
stdin
aaaaaaaaaaaa
stdout
\u1078\u1086\u1087\u1072