Answers for "php palindrome word check senza funzioni"

PHP
0

php palindrome word check senza funzioni

<?php
function Palindrome($MyString) {
  $l = 0;
  $r = strlen($MyString) - 1;
  $flag = 0;

  while($r > $l){
    if ($MyString[$l] != $MyString[$r]){
      $flag = 1;
      break;
    }
    $l++;
    $r--;
  }

  if ($flag == 0){
    echo $MyString." is a Palindrome string.\n";
  } else {
    echo $MyString." is not a Palindrome string.\n";
  }
}

Palindrome("radar");
Palindrome("rubber");
Palindrome("malayalam");
?>
Posted by: Guest on October-26-2021

Browse Popular Code Answers by Language