PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
kaisellgren
DevNet Resident
Posts: 1675 Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.
Post
by kaisellgren » Tue Dec 05, 2006 11:54 am
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?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Dec 05, 2006 11:56 am
preg_match() simply looks for a single match, nothing more. You want
preg_match_all() .
kaisellgren
DevNet Resident
Posts: 1675 Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.
Post
by kaisellgren » Tue Dec 05, 2006 11:57 am
Thank you mister feyd I'll try that one