Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class be_php_1_diskominfo_jabar
- {
- public static function isPalindrome($word)
- {
- $length = strlen($word);
- if ($length < 1) {
- return false;
- }
- for ($i=0; $i < $length; $i++) {
- if ( strcmp($word[$i], $word[$length-1-$i])) {
- return false;
- }
- }
- return true;
- }
- }
- echo (be_php_1_diskominfo_jabar::isPalindrome("onlyyou")) ? 'Ya ini palindrome' : 'Anda belum beruntung, coba lagi!';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement