Make See More Function Using PHP
Sometimes we need to save huge text or string in database. But if the content is very large then it may unfit to place website which destroy the beauty of the website. on the other hand it will also make the page critical to handle. Thus we need to cut a portion of the huge text to fit on the page. Later we can show the full portion of the text if user want to see. This is called Trimming.
How can we trim large text?
Its easy to clip a portion from large string using php with the help of a function named "substr(string, str_pos, limit)". Sub string function has 3 parameters:
- String: Here this parameter refers to the respective string thats need to clip.
- Str_pos: This refers to the position of the string where trimming will be started.
- Limit: This define the number of characters will be taken to clip from the string.
We will use this function and then apply few operation to optimize the see more feature.
Leave your Comment