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);
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);
It's simple: You should also check to subtract length of the $str
if the length is less that your required chars to remove.
substr($str,0,-10);