Re: Get Value
| From: | Robby Russell | Date: | Thu, 26 Aug 2004 04:18:35 +0000 |
| Subject: | Re: Get Value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194754@lists.php.net to get a copy of this message | ||
On Wed, 2004-08-25 at 21:11, Syed Ghouse wrote:
> Hi All
>
> Will anybody tell me how to extract the value (say Google)
> from the code below:
>
> <a href="www.google.com">Google(value to extract)</a>
>
> Thanks and Regards
>
> Syed
You can use regular expressions for this.
$in = '<a href="">meep</a>';
preg_match("|>(.*)</a>|", $in, $out);
$foo = $out[1];
print $foo;
...prints: meep
This is just a quick and dirty example of how this can be done.
-Robby
--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robby@planetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc