Make Palindrome Without Using Any Function In Php

To make a simple Palindrom we just have to write some little code that will work exactly according to our needs. We will get some input from the user and we will show that the word is palindrome or not. Exactly we will show false for word is not palindrome and true for the word is a perfect palindrome.

Code Example :

<form method="post">
<input type="text" name="txt"  /><br />
<input type="submit" name="sbt" />
</form>
<?php
error_reporting(0);
$string = $_POST['txt'];
$i=0;
$k = 0;
while( isset($string[$k]) ){
	$k++;
}
$strlen = $k;
$word = "";

while ($i <= $strlen){
	if(ord($string[$i]) == 32){
		$word .= "";
	}
	else{
		$word .= $string[$i];
	}
	$i++;
}
$a =	strlen($word);
			
$word2 = "";
$i = 0;

while ($a >= $i)
{
	$word2 .= $word[$a];
	$a--;
}
if ($word == $word2){
	echo "true";
}
else {
	echo "false";
}
?>