I have an array with information pulled from my database, the array contains an entire news article. Is there a easy way to strip just the first 100chars or so off the article so I can have a summary. Currently I have it done but im sure there is an easier way then this.
I take the multi-dimensional array $array[value1][value2] apply strip_tags($array[value1][value2]) to remove all html tags. Then I use explode('full article', $array[value1][value2]) As all my articles so far have the word full article in it after the summary. then I echo $array[value1][value2][0]; to take the summary. then I strip the first 5 characters of the article because its just the word title and I don't need that using substr($array[value1][value2][0], 5);. Now this works for me now just because all my articles are uniformed, if something were to change like the word title removed them the beginning or full article removed in the article this wouldn't work. Any ideas on how I can do this better?
Here is what the code looks like now.
$array[value1][value2] = strip_tags($array[value1][value2]);
$array[value1][value2] = explode('full article',$array[value1][value2]);
echo substr($array[value1][value2][0], 5);