Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <!--
- To change this license header, choose License Headers in Project Properties.
- To change this template file, choose Tools | Templates
- and open the template in the editor.
- -->
- <html>
- <head>
- <meta charset="UTF-8">
- <title></title>
- </head>
- <body>
- <?php
- $mot = $_POST["mot"];
- $ok = true;
- $i = 0;
- $j = strlen($mot) - 1;
- while($i <= $j)
- {
- $car1 = substr($mot, $i, 1);
- $car2 = substr($mot, $j, 1);
- if($car1 != $car2)
- {
- $ok = false;
- }
- $i++;
- $j--;
- }
- if ($ok == true)
- {
- echo "Il s'agit d'un palindrome";
- }
- else
- {
- echo "Il ne s'agit pas d'un palindrome";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement