Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
333 B
8
Indexable
Never
<?php

$mainString = readline("please insert the string :");

$reversed = ""; //21

//2112
//2112


for($i = strlen($mainString) - 1; $i >= 0; $i--){

    $reversed = $reversed . $mainString[$i];
                
}

if($mainString == $reversed){
    echo "this is OK" . PHP_EOL;
}else{
    echo "this is not palindrom" . PHP_EOL;
}