- str_split() function
- var_dump() function
- implode() function
User will input any value consist on 5 digits, then str_split() will split your word / sentence to array. And 2nd var_dump() function will show the value, type of array, then implode() function is used to combine the value.
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<!-- to take multiple inputs copy the below line and change name="input" attribute -->
Enter input 1: <input type="text" name="input" value="" /><br />
<input type="submit" name="submit" value="Submit" />
</form>
<?php
$inputs = array();
if (isset($_POST['input'])) //to check if the form was submitted
{
$inputs = str_split($_POST['input']);
var_dump($inputs);
if (count($inputs) == 5)
{
if(($inputs[0]==$inputs[4])&&($inputs[1]==$inputs[3]))
{
echo implode($inputs) . ' is a palindrome number. <br />';
}
else
{
echo implode($inputs) . ' is not a palindrome number. <br />';
}
}
else
{
echo "Try Again : Enter 5 Digit Number. :(";
}
}
?>
Post a Comment
Give your reviews about this blog. Leave your comments. what do you think about this post?
Comments Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe Samee Articles blog.
---------------------------------------
Thanks for visiting QWC.Me.
==========================================
For free guidelines contact me on SEO Expert | Samee Ullah Feroz is online there.
==========================================
Best Regards