Re: Using a list of (string) variables as preg_match result set?
| From: | php3 at developersdesk dot com | Date: | Fri, 05 Jan 2001 10:00:31 +0000 |
| Subject: | Re: Using a list of (string) variables as preg_match result set? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-32851@lists.php.net to get a copy of this message | ||
Addressed to: "Antti Boman" <antti.boman@mindcom.fi>
php-general@lists.php.net
** Reply to note from "Antti Boman" <antti.boman@mindcom.fi> Fri, 5 Jan 2001
09:41:15 +0200
>
> Couldn't find the solution for my problem, not in FAQ, php.net
> search, Deja or Google.
>
> Instead of using an array as preg_match result set, I'd like to use a
> list of basic string variables. For example:
>
> $str="I think this is a stupid example, but it shoud show what I want
> to know"; preg_match( "/(this) is a (stupid) example/", $str,
> list($whole,$first,$second) );
>
It is two statements, but:
preg_match( "/(this) is a (stupid) example/", $str, $temp );
list($whole,$first,$second) = $temp;
should work.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com