Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
function atbashCipher($input) {
$atbashMap = [
'0' => '10', '1' => '9', '2' => '8', '3' => '7', '4' => '6',
'5' => '5', '6' => '4', '7' => '3', '8' => '2', '9' => '1',
];
$output = '';
for ($i = 0; $i < strlen($input); $i++) {
$char = $input[$i];
if (isset($atbashMap[$char])) {
$output .= $atbashMap[$char];
} else {
$output .= $char;
}
}
return $output;
}
$input = "01234567890";
echo atbashCipher($input);
?>