fork(1) download
  1. <?php
  2.  
  3.  
  4. $code = ['a' => '1','b' => '2','c' => '3','d' => '4','d' => '5','e' => '6','f' => '7','g' => '8','h' => '9','i' => '10','j' => '11','k' => '12','l' => '13','m' => '14','n' => '15','o' => '16','p' => '17','q' => '18','r' => '19','s' => '20','t' => '21','u' => '22','v' => '23','w' => '24','x' => '24','y' => '25','z' => '26',];
  5.  
  6. $text = 'we are betrayed, switch the line';
  7. $cipher = strtr($text, $code);
  8. $numbers = array_flip($code);
  9. $decode = strtr($text, $numbers);
  10. echo "Original: {$text} \nEnigma: {$cipher}\n";
  11. echo "$decode";
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
Original: we are betrayed, switch the line 
Enigma: 246 1196 26211912565, 2024102139 2196 1310156
we are betrayed, switch the line