Trim string from left and from right
How can I trim 5 characters from a string from left and right side. e.g.
4k2l3k4jc9l3kancie9
What should be trimmed and kept are:
4k2l3 k4jc9l3ka ncie9
^ ^ ^
remove keep 开发者_如何转开发 remove
$string = substr($string, 5, -5);
$string = substr($string, 5, -5);//from left
$string = substr($string, 0, 5);//from right
精彩评论