Created
October 18, 2019 11:31
-
-
Save stephanBerger/0ea1a1d44295fc7e3121470346ba1552 to your computer and use it in GitHub Desktop.
3. Les chaînes de caractères en PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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