Can someone please help? As it says in the title, im trying "create" an alphabet in PHP, which my gf and I can only understand (it's a little thing that i thought to have with her), but im facing some problems.
I have this code here in HTML and PHP which its purpose is to replace an alphabet letter to some other character.
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>XXX</title>
<link href="assets/img/favicon.png" rel="icon">
<link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/style.css" rel="stylesheet">
<script src="assets/js/jquery.min.js"></script>
<style type="text/css">
@font-face { font-family: "Raleway"; src:url("assets/font/Raleway-Regular.ttf"); }
ul li {
list-style-type: none;
}
.row {
--bs-gutter-x: 1.5rem;
}
</style>
</head>
<body style="font-family: Raleway">
<main id="main" class="my-0">
<section class="contact">
<div class="container d-flex justify-content-center">
<div class="col-12 col-md-12 col-lg-5">
<div style="float: none; margin: auto">
<form method="post" role="form" class="php-email-form">
<div class="row form-group mt-md-0">
<textarea placeholder="AaBbCcDd" class="form-control" name="frase" style="height: 400px;resize: none;"></textarea><br>
</div>
<div class="row my-3">
<div class="col-4 col-sm-6 col-md-8 col-lg-6 form-group mt-md-0">
<button style="padding: 10px" type="submit" class="form-control" name="submit">Traduzir</button>
</div>
<div class="col-4 col-sm-3 col-md-2 col-lg-3 form-group mt-md-0">
<button formaction="descodificador.php" type="submit" class="form-control"><img src="assets/img/reverse.svg" width="15px"></button>
</div>
<div class="col-4 col-sm-3 col-md-2 col-lg-3 form-group mt-md-0" onclick="copiar(); return false;">
<button class="form-control botoes" type="submit"><img src="assets/img/copy.png" width="15px"></button>
</div>
</div>
<?php
if (isset($_POST['submit'])) {
$frase=$_POST["frase"];
if (!empty($frase)) {
Function translate($string) {
$alfabeto = array(
"a"=>"_","A"=>"_",
"b"=>"8","B"=>"8",
"c"=>"!","C"=>"!",
"d"=>"5","D"=>"5",
"e"=>"=","E"=>"=",
"f"=>"(","F"=>"(",
"g"=>"$","G"=>"$",
"h"=>"9","H"=>"9",
"i"=>'"',"I"=>'"',
"j"=>"1","J"=>"1",
"k"=>"+","K"=>"+",
"l"=>"@","L"=>"@",
"m"=>"2","M"=>"2",
"n"=>":","N"=>":",
"o"=>"7","O"=>"7",
"p"=>"<","P"=>"<",
"q"=>")","Q"=>")",
"r"=>"4","R"=>"4",
"s"=>"/","S"=>"/",
"t"=>"*","T"=>"*",
"u"=>"0","U"=>"0",
"v"=>">","V"=>">",
"w"=>";","W"=>";",
"x"=>"3","X"=>"3",
"y"=>"&","Y"=>"&",
"z"=>"6","Z"=>"6",
" "=>" ",
"?"=>"?",
"."=>".",
","=>",",
"-"=>"-","ç"=>"{");
$saida = array();
$entrada = str_split($string);
Foreach ($entrada as $key => $value) {
$saida[] = $alfabeto[$value];
}
Return implode('', $saida);
}
echo "<div id='frase' style='overflow:hidden;word-wrap:break-word'>".translate($frase)."</div>";
} else {
echo "<font style=color:#c46968>Caracter não suportado</font>";
}
} else {
echo "<font style=color:#68a4c4>Insere o texto</font>";
}
?>
</form>
</div>
</div>
</div>
</section>
</main>
<script type="text/javascript">
var listForRemove = [];
var listOfUniqe = [];
$('#frase').each(function () {
var text = $(this).text().trim();
if (listOfUniqe.indexOf(text) === -1)
listOfUniqe.push(text);
else
listForRemove.push($(this));
});
$(listForRemove).each(function () { $(this).remove(); });
</script>
<script type="text/javascript">
function copiar() {
if (window.getSelection) {
var range = document.createRange();
range.selectNode(document.getElementById("frase"));
window.getSelection().addRange(range);
document.execCommand("copy");
}
}
</script>
<script src="assets/vendor/aos/aos.js"></script>
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/vendor/glightbox/js/glightbox.min.js"></script>
<script src="assets/vendor/swiper/swiper-bundle.min.js"></script>
<script src="assets/js/main.js"></script>
</body>
But when I try to use the letter "ç" it appears this, and i can't really understand why and how to solve it
OUTPUT
Warning: Undefined array key "�" in C:\xampp\htdocs\XX\index.php on line 92
Warning: Undefined array key "�" in C:\xampp\htdocs\XX\index.php on line 92
Please help me, this is really important to me and my gf.