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; 

http://www.php.net/manual/de/domxpath.query.php


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -