[thelist] Extract a specific but changing part of a string (PHP)

Stefan Schwarzer st.schwarzer at geois.de
Fri May 16 08:46:43 CDT 2008


Hi there,

I am sure there is an efficient way to extract some part of a string.  
I have a string which looks like this:

	...<br />% countries: <b>73%</b><br />% population: <b>98%</b><br />%  
economy (GDP): ....

Now, I would like to extract the value which is to be found behind the  
"population: <b>".... As the string can vary in length I can't use a  
substring_number-from-left... thing. I could split the string behind  
"population: ", than eliminate "<b>" etc... But that seems rather  
complicated and ugly.

Can anyone give be a hint how I can achieve that nicely?

Thanks for any advice.

Stef


  ____________________________________________________________________

   Stefan Schwarzer

   Lean Back and Relax - Enjoy some Nature Photography
   http://photoblog.la-famille-schwarzer.de

   Appetite for Global Data? UNEP GEO Data Portal:
   http://geodata.grid.unep.ch
   ____________________________________________________________________









More information about the thelist mailing list