answersLogoWhite

0

You could use a function like this:


function isPalindrome($string) {

$string = strtolower($string);

return (strrev($string) == $string) ? true : false;

}


and then to check a palindrome call an if statement like so:



if(isPalindrome($test)) {

echo $test.' is a palindrome';

}

else {

echo $test.' is not a palindrome';

}

User Avatar

Wiki User

10y ago

What else can I help you with?

Continue Learning about Basic Math

Write a PHP program to check whether the string is palindrome or not?

You can do this: <?php if ( $word === strrev( $word ) ) { echo "The word is a palindrome"; } else { echo "The word is not a palindrome"; }


How can you run a php program?

To run PHP, just like any other programming/scripting language, you need to install an interpreter.If you're planning on using the PHP on a website, you can have a PHP interpreter run alongside your Apache/Nginx installation. Go ahead and look up the relevant installation information for your server's OS.


How do you compile php code?

To compile PHP code, you do not use a traditional compiler like you would with languages such as C++ or Java. PHP is an interpreted language, meaning the code is executed directly by the PHP interpreter. To run PHP code, you need a web server with PHP installed, such as Apache or Nginx. The PHP interpreter reads the code, processes it, and generates the output dynamically.


How do you write a program to print numbers from star one and next line star two in php?

Try the triangle program on a search engine. Replace numbers with stars and that should do the trick


How do you leran php?

To learn PHP it is best to read a few tutorials and then start trying out the things you read about. For instance, make a program that does some calculations and then prints the result on the screen. A good tutorial to start with can be found on: http://w3schools.com/php/default.asp or http://www.geekatude.com/PHP or http://php.net or http://www.phpmysqlbrain.com You can install the things in your local system , and then by referring the above websites try to write codes and see the results.

Related Questions

Write a PHP program to check whether the string is palindrome or not?

You can do this: <?php if ( $word === strrev( $word ) ) { echo "The word is a palindrome"; } else { echo "The word is not a palindrome"; }


Write a PHP program to check whether the number is palindrome or not?

This program only suits PHP. If you want a proper one try C program for it available on web <body> <?php if(isset($_POST['submit'])) { $text = $_POST['text']; $string = mysql_real_escape_string($text); $invert = strrev($string); if($string == $invert) { echo "<br>Given number is a palindrome!!"; } else { echo "<br>Given number is not a palindrome!!"; } } ?> <form method="post"> <input type="text" name="text" id="text" /> <input type="submit" name="submit" value="Submit" id="submit" onclick="<?php $_SERVER['PHP_SELF']; ?>" /> </form> </body>


Where can I find free php codes?

Ratinonal program in php


How do you write a palindrome program in c in Wikipedia?

You don't have to write palindrome programs in wikipedia.


Is php an interpretor?

PHP is in interpreted language, and ships with one, however PHP itself is a program language and not an interpreter.


What is the Malay-utf-8.inc. php file?

This particular file is a file specific to the PHP program or script you are using. It is not a "php system file".


Stack c language program of palindrome?

what ever you assume


What was the program used to make facebook?

PHP, Html


What program can read php file?

PHP files are plain text, so you can read them with your text editor or IDE of choice.


Is there widget in php?

well, as such there is no Widget in php. You need to write your own widget program if you are interested to develop. You must be aware of wordpress built on php plateform and that uses widget extensively :)


How run php program in wanp server in window?

Once you install wamp server. Any file with php extenstion like xyz.php you put in www folder will be executed as PHP file.


Photoshop is not the correct program to open the php files How can you remove it to use the correct file?

Assuming you're talking about incorrect default file associations in Windows XP... Right click on the PHP file. Go to Open With > Choose Program. Select Wordpad or your fav PHP IDE and tick the "Always open this type of file with this program" box.