1. <?php
  2. function test($in){
  3. return strtoupper(bin2hex(iconv('UTF-8', 'UCS-2', $in)))."\n";
  4. }
  5. echo test('Sześć siedem');
  6. echo test('Źdźbło');
  7. echo test('String with no special chars');
  8.  
  9. ----------
  10. Results:
  11.  
  12. 53007A0065005B0107012000730069006500640065006D00
  13. 790164007A01620042016F00
  14. 53007400720069006E0067002000770069007400680020006E006F0020007300700065006300690061006C00200063006800610072007300