I'm wondering if someone can explain why the following works with
preg_match_all, but not preg_match:
$html = "product=345678 9&"
preg_match_all ("|product=(\d{ 5,10})&|i", $html, $out);
$out[1][0] = 3456789
preg_match ("|product=(\d{ 5,10})&|i", $html, $out);
$out[1][0] = 3
For some reason, preg_match only returns the first character of the match.
Is this by design or does the regexp pattern need to be modified?
I'm curious to know what the difference is.
Thanks in advance.
preg_match_all, but not preg_match:
$html = "product=345678 9&"
preg_match_all ("|product=(\d{ 5,10})&|i", $html, $out);
$out[1][0] = 3456789
preg_match ("|product=(\d{ 5,10})&|i", $html, $out);
$out[1][0] = 3
For some reason, preg_match only returns the first character of the match.
Is this by design or does the regexp pattern need to be modified?
I'm curious to know what the difference is.
Thanks in advance.
Comment