fork download
  1. <?php
  2.  
  3. if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
  4. echo(<<<CODE
  5.   $alias = preg_replace_callback('/&#x([0-9a-f]{1,7});/i', function($matches) { return chr(hexdec($matches[1])); }, $alias);
  6.   $alias = preg_replace_callback('/&#([0-9]{1,7});/', function($matches) { return chr($matches[1]); }, $alias);
  7. CODE
  8. );
  9. } else {
  10. echo(<<<CODE
  11.   $alias = preg_replace('/&#x([0-9a-f]{1,7});/ei', 'chr(hexdec("\\1"))', $alias);
  12.   $alias = preg_replace('/&#([0-9]{1,7});/e', 'chr("\\1")', $alias);
  13. CODE
  14. );
  15. }
Success #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
     = preg_replace_callback('/&#x([0-9a-f]{1,7});/i', function() { return chr(hexdec()); }, );
     = preg_replace_callback('/&#([0-9]{1,7});/', function() { return chr(); }, );
stderr
PHP Notice:  Undefined variable: alias in /home/JpLMrM/prog.php on line 5
PHP Notice:  Undefined variable: matches in /home/JpLMrM/prog.php on line 5
PHP Notice:  Undefined variable: matches in /home/JpLMrM/prog.php on line 5
PHP Notice:  Undefined variable: alias in /home/JpLMrM/prog.php on line 6
PHP Notice:  Undefined variable: alias in /home/JpLMrM/prog.php on line 6
PHP Notice:  Undefined variable: matches in /home/JpLMrM/prog.php on line 6
PHP Notice:  Undefined variable: matches in /home/JpLMrM/prog.php on line 6
PHP Notice:  Undefined variable: alias in /home/JpLMrM/prog.php on line 6