Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. <?php
  2.  
  3. class be_php_1_diskominfo_jabar
  4. {
  5. public static function isPalindrome($word)
  6. {
  7. $length = strlen($word);
  8. if ($length < 1) {
  9. return false;
  10. }
  11. for ($i=0; $i < $length; $i++) {
  12. if ( strcmp($word[$i], $word[$length-1-$i])) {
  13. return false;
  14. }
  15. }
  16. return true;
  17. }
  18. }
  19.  
  20. 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