<?php
function encrypt($plain, $cipher, $text) {
	$plain = $plain . strtoupper($plain);
	$cipher = $cipher . strtoupper($cipher);
 
	$newText = '';
	for($i=0; $i<strlen($text); $i++)  {
		$c = $text[$i];
		$index = strrpos($plain, $c);
		if($index && $index < strlen($cipher)) {
			$newText = $newText . $cipher[$index];
		} else {
			$newText = $newText . $c;
		}
	}
	return $newText;
}
 
$plainAlphabet = "abcdefghijklmnopqrstuvwxyz";
$cipherAlphabet = "zyxwvutsrqponmlkjihgfedcba";
$text = "Some sensitive text that only humans must be able to read";
 
$encodedText = encrypt($plainAlphabet, $cipherAlphabet, $text);
echo $encodedText;
