Given any character from a to z, what is the most efficient way to get the next letter in the alphabet using PHP?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The most efficient way of doing this in my opinion is to just increment the string variable.
As seen incrementing
'z'give'aa'if you don’t want this but instead want to reset to get an'a'you can simply check the length of the resulting string and if its>1reset it.