<?php

error_reporting(-1);

$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',];

$text = 'we are betrayed, switch the line';
$cipher = strtr($text, $code);
$numbers = array_flip($code);
$decode = strtr($text, $numbers);
echo "Original: {$text} \nEnigma: {$cipher}\n";
echo  "$decode";