PHP Check if <ul> has ended IF it exists

Posted by Krewe on Stack Overflow See other posts from Stack Overflow or by Krewe
Published on 2012-09-18T15:12:28Z Indexed on 2012/09/18 15:37 UTC
Read the original article Hit count: 190

Filed under:
|
|

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] . "...";

© Stack Overflow or respective owner

Related posts about php

Related posts about list