开发者

preg_match parsing html tags and insert into variable

I have the following tags and I want to extract buying and selling price: 2.9450 and 3.0150

<tr bgcolor="开发者_JAVA百科#E8EFF3"> 
<td width="25%" align="center" valign="middle" class="tx11"> 
USD</td> 
<td width="8%" class="tx11">RON </td> 
<td align="right" class="tx11"> 
**2.9450**</td> 
<td width="8%" align="left" class="tx11"></td> 
<td align="right" class="tx11"> 
**3.0150**</td> 
<td width="8%" align="left" class="tx11"></td> 
<td align="right" class="tx11"> 
**2.9249**</td> 
</tr> 
  1. can anyone help me with the pattern for the values please?
  2. how can I extract the values into variables? thank you


preg_match_all( '/\*\*(.+?)\*\*/s', $str, $matches );

$matches[1][0] and $matches[1][1] will contain the two number you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜