Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $text = $_GET['text'];
- $newText = "";
- $word = "";
- for ($i=0; $i < strlen($text); $i++) {
- if (ctype_alpha($text[$i])) {
- $word .= $text[$i];
- } else {
- if(ctype_upper($word)){
- if(strrev($word) == $word){
- for($j = 0; $j < strlen($word); $j++){
- $newText .= $word[$j] . $word[$j];
- }
- } else {
- $newText .= strrev($word);
- }
- } else {
- $newText .= $word;
- }
- $newText .= $text[$i];
- $word = "";
- }
- }
- echo '<p>' . htmlspecialchars($newText) .'</p>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement