Created
May 25, 2015 08:43
-
-
Save kazz187/bd1a0091cfbf71024c9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$str = "よのなかねかおかおかねかなのよ"; | |
var_dump(kaibun_check($str)); | |
function kaibun_check($str) { | |
$char_code = 'utf8'; | |
$length = mb_strlen($str, $char_code); | |
for ($i = 0; $i < $length / 2; $i++) { | |
if (mb_substr($str, $i, 1, $char_code) !== mb_substr($str, $length - $i - 1, 1, $char_code)) { | |
return false; | |
} | |
} | |
return true; | |
} |
Author
kazz187
commented
May 25, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment