i am working on a function that will convert HTML to Plaintext version using php.I have tried with strip_tags()
as follows,
$html='<style type="text/css">
@media only screen and (max-width: 480px) {
.message_mobile {
width: 100% !important;
}
}
</style>
<p class="message_mobile"> sample Text</p>';
$plain_text =strip_tags($html);
echo $plain_text;
But it will create output like,
@media only screen and (max-width: 480px) {
.message_mobile {
width: 100% !important;
}
}
sample Text
But i don't need the content inside <style>
tag.How to do this?
And i have another problem,When i try to strip tags with a table,It will create unwanted line brakes.How to resolve these problems?
Is there any good methods for create plain text from HTML?