<?php
header("Content-Type: text/plain; charset=utf-8"); ?>
<?php
$text = <<<TEXT
<head>
<title>Форма заказа товара</title>
<meta http-equiv="Content-type" content="text/html" charset="windows-1251">
<meta name="keywords" content="">
<meta name="description" content="">
<div>
<empty>
</empty>
<p>
This is yet another text
<br/>
<b><!-- <i> это комментарий --><div class="1"><x это битый тег и он не считается
выведет
that wasn't
<b>
compliant
</b>
<b><!-- <i> это комментарий --><div class="1"><x это битый тег и он не считается
выведет
too...
<br/>
</p>
<div class="noClass">
this one is better but we don't care anyway
</div>
TEXT;
$commentPattern = "/(<!--).*(-->)/u";
$pattern = "/(<([\w]+)[^>]*>)/";
foreach ($new as $key => $value) {
echo $new[$key][2] . "\n";
}
PD9waHAKaGVhZGVyKCJDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgiKTsKPz4gCjw/cGhwCgptYl9pbnRlcm5hbF9lbmNvZGluZygiVVRGLTgiKTsKJHRleHQgICAgICAgICAgID0gPDw8VEVYVAogPGhlYWQ+Cjx0aXRsZT7QpNC+0YDQvNCwINC30LDQutCw0LfQsCDRgtC+0LLQsNGA0LA8L3RpdGxlPgo8bWV0YSBodHRwLWVxdWl2PSJDb250ZW50LXR5cGUiIGNvbnRlbnQ9InRleHQvaHRtbCIgY2hhcnNldD0id2luZG93cy0xMjUxIj4KPG1ldGEgbmFtZT0ia2V5d29yZHMiIGNvbnRlbnQ9IiI+CjxtZXRhIG5hbWU9ImRlc2NyaXB0aW9uIiBjb250ZW50PSIiPgo8ZGl2PgogICAgIDxlbXB0eT4KICAgICA8L2VtcHR5PgogICAgIDxwPgogICAgICAgVGhpcyBpcyB5ZXQgYW5vdGhlciB0ZXh0CiAgICAgICA8YnIvPgogICAgICAgPGI+PCEtLSA8aT4g0Y3RgtC+INC60L7QvNC80LXQvdGC0LDRgNC40LkgLS0+PGRpdiBjbGFzcz0iMSI+PHgg0Y3RgtC+INCx0LjRgtGL0Lkg0YLQtdCzINC4INC+0L0g0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