Re: preg_math vs preg_match_all

From: Date: Tue, 23 Nov 2004 13:36:42 +0000
Subject: Re: preg_math vs preg_match_all
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-37391@lists.php.net to get a copy of this message
Yemi Obembe wrote:
Just want to know the difference between preg_match and preg_match_all. preg_match stops after the first match.
preg_match_all gets *all* the matches. E.g. If you have a string -> $str = "foofoo"; preg_match('/foo/', $str, $match); -> $match will have an array with one "foo". preg_match_all('/foo/', $str, $match); -> $match will have an array with two "foo". Thats basically it.

« previous php.db (#37391) next »