PHP Check if <ul> has ended IF it exists
- by Krewe
I have my blog generate a preview by taking the first 300 characters and cut off the last whole word. My problem is, when I have a list near the top of the blog it is sometimes included in the preview, however the end list tag usually never is. So how can I check the $preview variable for a starting list tag, and if it is found, check for an ending tag and if it's not there add one.
All the code for my preview.
$preview = wordwrap($content, 300);
$preview = explode("\n", $preview);
$preview = $preview[0] . "...";