How to shorten a text?

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
User avatar
Drummer
New php-forum User
New php-forum User
Posts: 11
Joined: Thu Dec 17, 2020 12:31 am

Sat Feb 27, 2021 2:36 am

The $a variable contains the news text. The $link variable contains a link to the page with the full text of this news.
Need to write the abbreviated text of the news in the $b variable according to the rules:
- crop up to 180 characters
- assign an ellipsis
- make the last 2 words and ellipsis a link to the full text of the news.
iago
php-forum Active User
php-forum Active User
Posts: 41
Joined: Thu Mar 26, 2020 2:33 pm

Sat Mar 20, 2021 7:34 am

Do you have some code?
User avatar
hyper
php-forum GURU
php-forum GURU
Posts: 1222
Joined: Mon Feb 22, 2016 5:52 pm

Sat Mar 20, 2021 8:26 am

What have you tried?
Post Reply