Is there a php function that can chop let’s say 10 chars of the end of a string without calling strlen ? So I can avoid unnecessary repeating of variable names.
all I know is substr($str,0,strlen($str)-10);
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.
It’s simple: You should also check to subtract length of the
$strif the length is less that your required chars to remove.