I have this code that I need to add substr
to, to limit the description output to 100 characters:
description=<?=nl2br(strip_tags($v['listing_description']));?>
Where and how do I add substr
to this line?
I have tried a few different methods, with no success.
The substr
goes between nl2br
and strip_tags
:
description=<?=nl2br(substr(strip_tags($v['listing_description']), 0, 100));?>
The reason for this is because you first want to strip_tags
(the inner-most parentheses), then substr
to 100 characters, then convert new-lines to <br>
s.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.