RE: [PHP-WIN] Return portion of a string
| From: | brother | Date: | Wed, 15 May 2002 14:33:09 +0000 |
| Subject: | RE: [PHP-WIN] Return portion of a string | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-13792@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: R.S. Herhuth [mailto:ronherhuth@pop.mindspring.com]
>
> <a href="javascript:void(EXTERNALLINK('102'))">
>
> There might be many occurrances of this substring in exactly the same
> format but the id's will be unique with each occurance.
>
> Can someone please show me how to extract the id's (in this case the
> 102) of the above string into an array? I have been through the
> documentation on substrings and regular expressions but I'm just not
> getting it.
This may not be the best way but you could use explode to get it into an
array and then use that as an varible.
http://se.php.net/manual/en/function.explode.php
$data =<a href="javascript:void(EXTERNALLINK('102'))">
$var = explode("'",$data);
$var['2'] would then be the id number (I cann't recall the function really
so I hope I didn't make any mistakes now =)
/brother