Using php, i would like to take an all lowercase word and if the first letter of the word starts with an i then capitalise the second letter.
So if my word was iphone then after the preg_replace() the string would be iPhone.
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.
Try this:
This code checks a single word to see if it is all lowercase. If so it capitalizes the second letter.
If it gets more complex, you may want to use preg_replace_callback() instead.