$key2val = [=>, =>, =>, =>, =>, =>, =>,
        =>, =>, =>, =>, =>, =>, =>, =>,
        =>, =>, =>, =>, =>, =>, =>,
        =>, =>, =>, =>, =>, =>, =>,
        =>, =>, =>, =>, =>, =>, =>,
        =>, =>];

$val2key = array_flip($key2val);

function encode(string $s) : string  {
    global $key2val;

    $callback = function($c) use ($key2val) { return $key2val[$c]?? ''; };

    return implode(array_map($callback, str_split(strtoupper($s))));
}

function decode(string $s) : string {
     global $val2key;

     $callback = function($c) use ($val2key) { return $val2key[$c]?? ''; };

     preg_match_all('/79.|7.|3.|./', $s, $m);

     return implode(array_map($callback, $m[0]));
}   

function main($s) {
    $encoded = encode($s);
    echo $encoded;
    echo ;
    echo decode($encoded);    
}

main('One night-it was on the twentieth of March, 1888-I was returning');