I want trim word by almost half for example
Washington
after trim it should be washi
Chicago
after trim it should be chic
Tokyo
after trim it should be tok
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.
substr()function to cut off unwanted part of the string.strlen()function to calculate the length of the string.Use
ceil()function to round a fraction up if the length is a odd number.If you’re using Unicode then use multibyte extension functions as PHP doesn’t support Unicode natively.