开发者

PHP: what method to use when trimming a string to certain amount of chars?

if (strlen($filename) > 70) { //trim the string to 70 chars //delete chars from the beginning! }

what method do i use.

rega开发者_运维知识库rds matt


$filename = substr($filename, -70);


to get the last chars from a string:

substr($string, -70);

first 70 chars:

substr($string, 0, 70);

but, of course, you could check php docs for more info.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜