Php exclude text

i have html file contains tables and text, i need a function to exclude all the text in the body tag except the table tags and the text inside it .

Hi,

You should look into strip_tags()

http://php.net/manual/en/function.strip-tags.php


strip_tags($html, '<table><tr><td><th><thead><tbody><tfoot>');

where $html is the string containing your table code.

Note: This will also strip out any other html tags you may have in your table.