Skip to content

Instantly share code, notes, and snippets.

@b0ndurant
Created March 5, 2018 16:20
Show Gist options
  • Save b0ndurant/151829f16a60ea32c7c0969232aff3d4 to your computer and use it in GitHub Desktop.
Save b0ndurant/151829f16a60ea32c7c0969232aff3d4 to your computer and use it in GitHub Desktop.
quete chaine de caractere
<?php
$message = "0@sn9sirppa@#?ia'jgtvryko1";
$chiffre_cle = strlen($message)/2;
$sous_chaine = substr($message, 5, $chiffre_cle);
$word = array("@", "#", "?");
$rep = array(' ');
$new = str_replace ($word, $rep, $sous_chaine);
echo strrev($new);
echo "<br/>";
$message1 = "q8e?wsellecif@#?sel@#?setuotpazdsy0*b9+mw@x1vj";
$chiffre_cle1 = strlen($message1)/2;
$sous_chaine1 = substr($message1, 5, $chiffre_cle1);
$word1 = array("@", "#", "?");
$rep1 = array(' ');
$new1 = str_replace ($word1, $rep1, $sous_chaine1);
echo strrev($new1);
echo "<br/>";
$message2 = "aopi?sgnirts@#?sedhtg+p9l!";
$chiffre_cle2 = strlen($message2)/2;
$sous_chaine2 = substr($message2, 5, $chiffre_cle2);
$word2 = array("@", "#", "?");
$rep2 = array(' ');
$new2 = str_replace ($word2, $rep2, $sous_chaine2);
echo strrev($new2);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment