I’m working on news script and I would like to create summary function to get little of text from full text content. The function would get 200 characters of full text and then it would search for last space of these 200 characters. The function must also ignore any html or other code and show only first 200 characters of full text content.
Which function is the best for my problem and how to do that function?
Checkout this helper function from the
CodeIgniterframework:You can use the function:
echo character_limiter($text, 200);If you need to avoid HTML tags, you can use
strip_tagsfunction before calling thecharacter_limiterfunction.