/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function closetags ( $html ) { #put all opened tags into an array $openedtags = $result[1]; #put all closed tags into an array $closedtags = $result[1]; # all tags are closed { return $html; } # close tags for( $i = 0; $i < $len_opened; $i++ ) { { $html .= "</" . $openedtags[$i] . ">"; } else { } } return $html; } $snippet = "<div>This is some interesting <strong><em>content!"; $x = closetags ( $snippet );
URL: http://snipplr.com/view/3618/close-tags-in-a-htmlsnippet/