Thursday, September 26, 2019

String Palindrome in PHP

A simple program that I wrote using PHP that will ask the user to give a string and then the program will check if the given string is a Palindrome or Not a Palindrome.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.


My personal website is http://www.jakerpomperada.com.



Sample Program Output


Program Listing

index.php

<html>
<style>
 body {
font-size: 20;
font-family:sans-serif;
font-weight: bold;
 }
input {
font-size: 20px;
font-weight: bold;
}
 /* http://cssdemos.tupence.co.uk/button-styling.htm */ 
 input#shiny {
padding: 4px 20px;
/*give the background a gradient*/
background:#ffae00; /*fallback for browsers that don't support gradients*/
background: -webkit-linear-gradient(top, blue,blue);
background: -moz-linear-gradient(top, blue, blue);
background: -o-linear-gradient(top, blue, blue);
background: linear-gradient(top, blue, blue);
border:2px outset #dad9d8;
/*style the text*/
font-family:Andika, Arial, sans-serif; /*Andkia is available at http://www.google.com/webfonts/specimen/Andika*/
font-size:1.1em;
letter-spacing:0.05em;
text-transform:uppercase;
color:#fff;
text-shadow: 0px 1px 10px #000;
/*add to small curve to the corners of the button*/
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
/*give the button a drop shadow*/
-webkit-box-shadow: rgba(0, 0, 0, .55) 0 1px 6px;
-moz-box-shadow: rgba(0, 0, 0, .55) 0 1px 6px;
box-shadow: rgba(0, 0, 0, .55) 0 1px 6px;
}
/****NOW STYLE THE BUTTON'S HOVER STATE***/
input#shiny:hover, input#shiny:focus {
border:2px solid #dad9d8;
}
 </style>
<body>
 <?php
 error_reporting(0);
 $values = $_POST['inputText'];
 if(isset($_POST['ClearButton'])){
 $values = "";
 }
?>
 <br>
 <h4> String Palindrome in PHP</h4>
 <h5> Created By Jake Rodriguez Pomperada</h5>
 <form action="" method="post">
 Give a String
 <input type="text" name="inputText" size="30" maxlength="30"
 value="<?php echo $values; ?>" style="width:200px; height:30px;" required autofocus=""/>
 <br><br>
 <input id="shiny" type="submit" value="Ok" name="SubmitButton"/>
    
 <input id="shiny" type="submit" value="Clear" name="ClearButton"/>
</form>
<?php

function check_palindrome($string) 
{
  if ($string == strrev($string))
      echo "The given string $string is a PALINDROME.";
  else
  echo "The given string $string is NOT a PALINDROME.";
}


$values = $_POST['inputText'];
if(isset($_POST['SubmitButton'])){
$num_val = strtoupper($values);
echo "<br>";
check_palindrome($num_val);
}
?>
</body>
</html>




No comments:

Post a Comment