3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @helghanman decryption algorithm * DECLASSIFIED///VSA///SIGINT///DECRYPT */ # Encoded message $message ='077175091 084063 056035 168021105056175084'; # do not edit below this line!! /******************************************************************/ # Cipher substitution $substitutionArray = array( 'q' => 1, 'w' => 2, 'e' => 3, 'r' => 4, 't' => 5, 'y' => 6, 'u' => 7, 'i' => 8, 'o' => 9, 'p' => 10, 'a' => 11, 's' => 12, 'd' => 13, 'f' => 14, 'g' => 15, 'h' => 16, 'j' => 17, 'k' => 18, 'l' => 19, 'z' => 20, 'x' => 21, 'c' => 22, 'v' => 23, 'b' => 24, 'n' => 25, 'm' => 26, ',' => 27, '.' => 28, '1' => 29, '2' => 30, '3' => 31, '4' => 32, '5' => 33, '6' => 34, '7' => 35, '8' => 36, '9' => 37, '#' => 38, ); # Rotation7 $r = 7; # Decoding algorithm function decode($string, $substitutionArray, $r = 1) { $result = ''; $stringArray = explode(" ", $string); $substitutionArray = array_flip($substitutionArray); foreach ($stringArray as $word) { for ($i = 0; $i <= strlen($word)-3; ) { $cipher = intval(substr($word, $i, 3))/$r; $result .= $substitutionArray[$cipher]; $i = $i+3; } $result .= ' '; } return $result; } # Print decoded message print decode($message, $substitutionArray, $r); ?>

preferences:
39.32 ms | 402 KiB | 5 Q