PHP's method to determine whether a string is a return string
This article describes how to use PHP to determine whether a string is a return string. The example analyzes the php operation string to determine whether a return string is a return string. It has some reference value. For more information, see
This example describes how PHP judges whether a string is a return string. Share it with you for your reference. The specific implementation method is as follows:
?
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<? Php Function ishuiwen ($ str ){ $ Len = strlen ($ str ); $ L = 1; $ K = intval ($ len/2) + 1; For ($ j = 0; $ j <$ k; $ j ++ ){ If (substr ($ str, $ j, 1 )! = Substr ($ str, $ len-$ J-1, 1 )) { $ L = 0; Break; } } If ($ l = 1) { Return 1; } Else { Return-1; } } $ Str = 12321; Echo ishuiwen ($ str ); ?> |
I hope this article will help you with php programming.