fork(3) download
  1. <?php
  2.  
  3. $toDecode = "Hello,\\x20World\\x21\\x20How\\x20are\\x20you\\x3F"; //file_get_contents('hex.txt');
  4.  
  5. function escapedHexToHex($escaped)
  6. {
  7. // return 'OK!';
  8. return chr(hexdec($escaped[1]));
  9. }
  10.  
  11. $decoded = preg_replace_callback('/\\\\x([a-f0-9]{2})/i','escapedHexToHex', $toDecode);
  12.  
  13. echo $decoded; //file_put_contents('haha.txt', $decoded);
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
Hello, World! How are you?