Quantcast
Channel: Web Tools
Viewing all articles
Browse latest Browse all 16

Truncate a string in PHP without breaking words

$
0
0
I was working on PHP project that require to get a text from MySQL and display only 50 character. Thus I used php substr function to truncate a text to first 50 character. $text="quick brown fox jumps over the lazy dog. quick brown fox jumps over the lazy dog."; echo substr($text, 0, 50); Output Of above code […]

Viewing all articles
Browse latest Browse all 16

Trending Articles