3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function IsCasiPalindromo($str){ $count = 0; $idx1 = 0; $idx2 = strlen($str)-1; while($idx1 <= $idx2){ if($str[$idx1] != $str[$idx2]){ $count++; } $idx1++; $idx2--; } return ($count<=1); } echo IsCasiPalindromo("abccba") . '<br>'; echo IsCasiPalindromo("abccbx") . '<br>'; echo IsCasiPalindromo("abccfg") . '<br>';
based on 80UNs
Output for 5.3.19 - 7.3.0rc6
1<br>1<br><br>