I’m trying to do the following.
if (<ul></ul> appear side by side within a script) remove them {
}else { leave all other <ul></ul> in place that contain content within them.
I have a script that’s producing some extra <ul></ul> i.e. without text within them and simply want to remove them before I print to the browser.
I’ve tinkered with the following and tried strip_tags too but neither are really giving me the result. Is there a function that I can use to do this?
Thanks for any help.
Code: Select all
<?PHP
$needs_cleaning = "<li><ul></ul></li>" ;
$cleaned = str_replace($needs_cleaning, "<ul></ul>","") ;
print $cleaned ;
?>