- substr: documentation ( source)
- strpos: documentation ( source)
- print_r: documentation ( source)
<?php
$htmlC = '<html><body>fdagedg sgsdfg </body> </html>';
$htmlsend = $htmlC;
$pos = strpos($htmlsend, '</body>');
if ($pos !== false) {
$strBeforeBody = substr($htmlsend, 0, $pos);
$html = $strBeforeBody . '######sfdgzdfgdf########' . substr($htmlsend, $pos);
$htmlC .= $html;
print_r($htmlC);
}