Skip to content

Instantly share code, notes, and snippets.

@stephanBerger
Created October 18, 2019 11:31
Show Gist options
  • Save stephanBerger/0ea1a1d44295fc7e3121470346ba1552 to your computer and use it in GitHub Desktop.
Save stephanBerger/0ea1a1d44295fc7e3121470346ba1552 to your computer and use it in GitHub Desktop.
3. Les chaînes de caractères en PHP
<?php
function decrypt(string $chaine) : string {
$keyNumber = strlen($chaine)/2;
$sousChaine = substr($chaine,5,$keyNumber);
$resultat = str_replace('@#?',' ',$sousChaine);
return strrev($resultat);
}
$message1 = "0@sn9sirppa@#?ia'jgtvryko1";
$message2 = "q8e?wsellecif@#?sel@#?setuotpazdsy0*b9+mw@x1vj";
$message3 = "aopi?sgnirts@#?sedhtg+p9l!";
echo decrypt($message1).' '.decrypt($message2).' '.decrypt($message3).".\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment