fork download
  1. <?php
  2.  
  3. echo "PHP version: ".phpversion()."\n\n";
  4.  
  5. echo "The following should work in all PHP versions:\n";
  6. echo "\\x can escape a single hex digit: TAB\x9TAB";
  7. echo "\n\n";
  8.  
  9. echo "Three UTF-8 bytes via \\x: \xE0\xBC\x82"; # U+0F02
  10. echo "\n";
  11. echo "Four UTF-8 bytes via \\x: \xF0\x9F\x91\xBE"; # U+1F47E
  12.  
  13. echo "\n\n";
  14.  
  15. echo "The following should work starting in PHP version 7.0.0:\n";
  16. echo "Code Point / UTF-32 via \\u{}: \u{0F02}";
  17. echo "\n";
  18. echo "Code Point / UTF-32 via \\u{}: \u{1F47E}";
  19. ?>
  20.  
  21.  
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
PHP version: 7.1.1-1

The following should work in all PHP versions:
\x can escape a single hex digit: TAB	TAB

Three UTF-8 bytes via \x: ༂
Four UTF-8 bytes via \x: 👾

The following should work starting in PHP version 7.0.0:
Code Point / UTF-32 via \u{}: ༂
Code Point / UTF-32 via \u{}: 👾