3v4l.org

run code in 200+ PHP versions simultaneously
<?php function IsCasiPalindromo($str){ $count = 0; $idx1 = 0; $idx2 = strlen($str)-1; while($idx1 <= $idx2){ if($str[$idx1] != $str[$idx2]){ $count++; echo 'false'; } $idx1++; $idx2--; } return true; } echo IsCasiPalindromo("abccba") . '<br>'; echo IsCasiPalindromo("abccbx") . '<br>'; echo IsCasiPalindromo("abccfg") . '<br>';
based on K0PEU
Output for 4.3.0 - 7.4.0rc4
1<br>false1<br>falsefalse1<br>