Re: Text between two tags
| From: | Richard Lynch | Date: | Thu, 10 Nov 2005 21:13:41 +0000 |
| Subject: | Re: Text between two tags | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-225547@lists.php.net to get a copy of this message | ||
On Thu, November 10, 2005 8:56 am, Normmy2k wrote:
> Example
> I have this string :
> $text='<td></td>
> <td align="right" class="yfnc_tabledata3"></td>
> <td></td>
> <td align="right" class="yfnc_tabledata2"></td>
> <td></td>
> <td align="right" class="yfnc_tabledata1">1234</td>
> <td></td> <td></td> <td></td> <td
> align="right"
> class="yfnc_tabledata5"></td> ';
>
> And I want to retrieve the number 1234 between <td align="right"
> class="yfnc_tabledata1"> and </td>
If that string is consistently what you have, then this would also work:
$number = (int) trim(strip_tags($text));
This may prove more resilent to HTML changes from the source that is
generating all those table tags...
--
Like Music?
http://l-i-e.com/artists.htm