开发者

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

开发者 https://www.devze.com 2023-01-16 02:44 出处:网络
if (strlen($filename) > 70) { //trim the string to 70 chars //delete chars from the beginning! } what method do i use.

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

精彩评论

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