palindromo - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of palindromo.php
- <?php
- $a="anna";
- $b= str_split($a);
- for($i=0;$i<count($b);$i++)
- print $b[$i];
- print"\r\n";
- $verifica=true;
- for($i=0;$i<count($a);$i++)
- if($b[i]==$b[count($b)-1-$i])
- $verifica=$verifica&&($b[$i]==$b[count($b)-1-$i]);
- if($verifica)
- print"l'input è un palindromo";
- else
- print"l'input non è un palindromo";
- ?>