tag and its content from HTML using php-无人共我的回答
tag and its content from HTML using php
Below is the text I need to remove tags from
Addiction, stress and subjective wellbeing The need and signi
Addiction, stress and subjective wellbeing
The need and signi
This code removes one p-tag:
function parse($html) { $dom = new DOMDocument(); @$dom->loadHTML($html); $ps = $dom->getElementsByTagName('p'); //die(''.print_r($ps,1).''); if ($ps->length === 1){ $p = $ps->item(0); return $p->nodeValue; } else { return ''; } }
'.print_r($ps,1).'