I am trying to create a div element using a PHP dom document and it's working as expected. but when I try to insert a line break it's not working. I have imported the dom document to mpdf for generating PDF. I have tried the following code
$document = new DomDocument();
$value = 'First line<br>Second line';
$all_inputs = $xpath->query( '//input | //textarea | //img | //script' );
$len = $all_inputs->length;
for ( $i = 0; $i < $len; $i++ ) {
$input = $all_inputs->item( $i );
$div = $document->createElement( 'div' );
$div->textContent = $value;
$input->parentNode->replaceChild( $div, $input );
}
$document->saveHTML();