This is a PHP code using function logic to check the string. I'm processing .whats ... iam Unable to understand
function Palindrome ($ string) {if ((strlen ($ string) == 1) || (strlen ($ string) == 0)) {echo "STRING ISI Palandrom "; } And {if (substr ($ string, 0,1) == substr ($ string, strlen ($ string) - 1), 1)) {return rhythm (substr ($ string, 1, strlen ($ string) -2)); } And {echo "STRING is not a Palandro"; }}} Pilandrom ("121");
This function takes string arguments as input
First, it works, the recursive base checks the case we will bring it back to it
If the base case is not satisfied, then checks to see if the first letter using the code is the last character Matches: if (substr ($ string, 0,1) == substr ($ string, (strlen ($ string) - 1), 1)) If it matches, then call the function again again. This is done by this line,
Returns Palendrom (substrings ($ string, 1, strlen ($ string) -2), but this time it is removed with the first and last character. ); If the first character does not match the last character, then the function automatically echo through the HTML "STRING ISO not Palondrome
Now in the base case I have mentioned before, if the function succeeds and removes the first and the last character, then there is no string remaining Has been confirmed to be pulandrome and this string is echos
If you need help with Rickson, then tell me, I will post the tutorial link
No comments:
Post a Comment