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
$str = 'abc';
echo strtoupper(strrev(caesarCipher($str, 5)));
function caesarCipher($message, $shift) {
$cipherText = "";
$len = strlen($message);
for ($i = 0; $i < $len; $i++) {
if (ctype_alpha($message[$i])) {
$asciiOffset = ord(ctype_upper($message[$i])) ? 65 : 97;
$cipherText .= chr(((ord($message[$i]) - $asciiOffset + $shift) % 26) + $asciiOffset);
} else {
$cipherText .= $message[$i];
}
}
return $cipherText;
}