given the following string in PHP:
$html = \"
text 1
using the PHP Simple HTML DOM Parser
Updated and tested! You can get the simple_html_dom.php include from the above link or here.
for both cases:
include('../simple_html_dom.php');
$html = str_get_html("text 1
text 2
text 3
text 4
");
case 1:
foreach($html->find('span[class*="test2"]') as $e)
$e->class = '';
echo $html;
case 2:
foreach($html->find('span[class*="test2"]') as $e)
$e->parent()->innertext = $e->plaintext;
echo $html;