Page 1 of 1

Simple but wierd PCRE problem...

Posted: Tue Dec 05, 2006 11:54 am
by kaisellgren
Hi,

My PCRE:

Code: Select all

$content = "function function function hu function";
preg_match("/function/",$content,$matches);
echo = count($matches);
And it echoes 1 ! Why doesn't it echo 4?

Posted: Tue Dec 05, 2006 11:56 am
by feyd
preg_match() simply looks for a single match, nothing more. You want preg_match_all().

Posted: Tue Dec 05, 2006 11:57 am
by kaisellgren
Thank you mister feyd I'll try that one :)