How to split a string from the word using php -
i want text in between of font tag remove tags using php.
<textformat leading="2"> <p align="left"> <font face="verdana" size="10" color="#0b333c" letterspacing="0" kerning="0">welcome</font> </p> </textformat> <textformat leading="2"> <p align="left"> <font face="verdana" size="10" color="#0b333c" letterspacing="0" kerning="0"></font> </p> </textformat> <textformat leading="2"> <p align="left"> <font face="verdana" size="10" color="#0b333c" letterspacing="0" kerning="0"></font> </p> </textformat> <textformat leading="2"> <p align="left"> <font face="verdana" size="10" color="#0b333c" letterspacing="0" kerning="0"></font> </p> </textformat> <textformat leading="2"> <p align="left"> <font face="verdana" size="10" color="#0b333c" letterspacing="0" kerning="0">test of test asdasd</font> </p> </textformat> <textformat leading="2"> <p align="left"> <font face="verdana" size="10" color="#0b333c" letterspacing="0" kerning="0">asdsadsadsadsad</font> </p> </textformat>
if xml allways valid xml (html not), import domdocument , font-nodes via xpath queries.
this way, still have full node in question attributes, parents , children.
$doc = new domdocument($input); $xpath = new domxpath($doc); $query = '//font'; $entries = $xpath->query($query); foreach ($entries $entry) echo $entry->nodevalue;
Comments
Post a Comment