fork download
  1. <?php
  2.  
  3. $zero = '!![]';
  4. $nums = ['![]','${![]}','${!![]}','$${[]}','$${![]}','$${!![]}','$$${[]}','${[].[]}'];
  5. $initChr = "\${[]}=([].[])[![]+![]+![]];\${[]}++;\${[]}++;\${+![]}=\${[]};" .
  6. "\${[]}++;\${[]}++;\${[]}++;\${[]}++;\${[]}++;\${+![]}.=\${[]};" .
  7. "\${[]}=\${+![]}.([].[])[![]];";
  8. $chr = '${[]}';
  9.  
  10. function initNumbers() {
  11. global $nums;
  12. $n = $nums[0];
  13. $code = '';
  14. foreach ($nums as $v => $num) {
  15. if (!$v) continue;
  16. $v = join('+', array_fill(0, 2, $n));
  17. $code .= "$num=$v;";
  18. $n = $num;
  19. }
  20. return $code;
  21. }
  22.  
  23. function number($n) {
  24. global $nums, $zero;
  25. if ($n < 0 || $n > 255) die("Invalid number: $n.");
  26. if (!$n) return $zero[0];
  27. $i = 0;
  28. while($n) {
  29. $d = $n % 2;
  30. if($d) $code[] = join('+', array_fill(0, $d, $nums[$i]));
  31. $n /= 2;
  32. $i++;
  33. }
  34. return join('+', $code);
  35. }
  36.  
  37. function char($c) {
  38. global $chr;
  39. $c = number(ord($c));
  40. return "$chr($c)";
  41. }
  42.  
  43. function str($s) {
  44. return join('.', array_map('char', str_split($s)));
  45. }
  46.  
  47. function prettify($fucked) {
  48. $line = '';
  49. $ops = preg_split('/([;.])/', $fucked, -1, PREG_SPLIT_DELIM_CAPTURE);
  50. foreach($ops as $op) {
  51. if(strlen($line) + strlen($op) + 1 > 80) {
  52. $lines[] = $line;
  53. $line = '';
  54. }
  55. $line .= $op;
  56. }
  57. $lines[] = $line;
  58. return join("\n", $lines);
  59. }
  60.  
  61. function fuckify($code) {
  62. global $chr, $initChr;
  63. $nums = initNumbers();
  64. $php = '$$$${[]}';
  65. $initPHP = $php . '=(' . str('popen') . ')(' . str('php') . ',' . char('w') . ');';
  66. $fputs = str('fputs');
  67. $pclose = str('pclose');
  68. $code = str($code);
  69. return prettify("<?php\n$initChr$nums$initPHP($fputs)($php,$code);($pclose)($php);");
  70. }
  71.  
  72. $code = '';
  73. while ($line = fgets(STDIN)) $code .= $line;
  74. print(fuckify($code));
Success #stdin #stdout 0.03s 23880KB
stdin
bormand
<?php
print('my love');
stdout
<?php
${[]}=([].[])[![]+![]+![]];${[]}++;${[]}++;${+![]}=${[]};${[]}++;${[]}++;
${[]}++;${[]}++;${[]}++;${+![]}.=${[]};${[]}=${+![]}.([].[])[![]];
${![]}=![]+![];${!![]}=${![]}+${![]};$${[]}=${!![]}+${!![]};
$${![]}=$${[]}+$${[]};$${!![]}=$${![]}+$${![]};$$${[]}=$${!![]}+$${!![]};${[].
[]}=$$${[]}+$$${[]};$$$${[]}=(${[]}($${![]}+$${!![]}+$$${[]}).
${[]}(![]+${![]}+${!![]}+$${[]}+$${!![]}+$$${[]}).
${[]}($${![]}+$${!![]}+$$${[]}).${[]}(![]+${!![]}+$${!![]}+$$${[]}).
${[]}(${![]}+${!![]}+$${[]}+$${!![]}+$$${[]}))(${[]}($${![]}+$${!![]}+$$${[]}).
${[]}($${[]}+$${!![]}+$$${[]}).
${[]}($${![]}+$${!![]}+$$${[]}),${[]}(![]+${![]}+${!![]}+$${![]}+$${!![]}+$$${[]}))
;(${[]}(${![]}+${!![]}+$${!![]}+$$${[]}).${[]}($${![]}+$${!![]}+$$${[]}).
${[]}(![]+${!![]}+$${![]}+$${!![]}+$$${[]}).
${[]}(${!![]}+$${![]}+$${!![]}+$$${[]}).
${[]}(![]+${![]}+$${![]}+$${!![]}+$$${[]}))($$$${[]},${[]}(${![]}+$${!![]}+$$${[]})
.${[]}(![]+${![]}+${!![]}+$${[]}+$${!![]}+$$${[]}).
${[]}(${![]}+$${![]}+$${!![]}+$$${[]}).
${[]}(![]+${!![]}+$${[]}+$${!![]}+$$${[]}).${[]}(![]+$${!![]}+$$${[]}).
${[]}(${![]}+${!![]}+$${[]}+$${!![]}+$$${[]}).${[]}(${!![]}+$${!![]}+$$${[]}).
${[]}(${![]}+$${[]}).${[]}(${!![]}+$${[]}+$${![]}+$${!![]}).
${[]}(![]+${![]}+${!![]}+$${[]}+$${![]}+$${!![]}).
${[]}($${![]}+$${!![]}+$$${[]}).${[]}($${[]}+$${!![]}+$$${[]}).
${[]}($${![]}+$${!![]}+$$${[]}).${[]}(${![]}+$${[]}).
${[]}($${![]}+$${!![]}+$$${[]}).${[]}(${![]}+$${![]}+$${!![]}+$$${[]}).
${[]}(![]+$${[]}+$${!![]}+$$${[]}).
${[]}(${![]}+${!![]}+$${[]}+$${!![]}+$$${[]}).
${[]}(${!![]}+$${![]}+$${!![]}+$$${[]}).${[]}($${[]}+$${!![]}).
${[]}(![]+${![]}+${!![]}+$${!![]}).${[]}(![]+${!![]}+$${[]}+$${!![]}+$$${[]}).
${[]}(![]+$${[]}+$${![]}+$${!![]}+$$${[]}).${[]}($${!![]}).
${[]}(${!![]}+$${[]}+$${!![]}+$$${[]}).
${[]}(![]+${![]}+${!![]}+$${[]}+$${!![]}+$$${[]}).
${[]}(${![]}+${!![]}+$${![]}+$${!![]}+$$${[]}).
${[]}(![]+${!![]}+$${!![]}+$$${[]}).${[]}(![]+${![]}+${!![]}+$${!![]}).
${[]}(![]+$${[]}+$${!![]}).${[]}(![]+${![]}+$${[]}+$${![]}+$${!![]}));
(${[]}($${![]}+$${!![]}+$$${[]}).${[]}(![]+${![]}+$${!![]}+$$${[]}).
${[]}(${!![]}+$${[]}+$${!![]}+$$${[]}).
${[]}(![]+${![]}+${!![]}+$${[]}+$${!![]}+$$${[]}).
${[]}(![]+${![]}+$${![]}+$${!![]}+$$${[]}).
${[]}(![]+${!![]}+$${!![]}+$$${[]}))($$$${[]});