I am creating a questionaire that can pull answers already submitted for use in other questions. It basically looks for [answer][/answer] tags and then performs accordingly if found. It is working except for the count of the number of tags found being wrong. It seems that whether there is one set of tags found or 5 sets of tags found, it returns 2. What have I done wrong? Thanks in advance!
if (preg_match_all("/\[answer\]([^\[]*)/is", $question_content, $arr, PREG_SET_ORDER))
{
// [answer] tag(s) found, determine proper dynamic inserts
$count = count($arr[0]);
echo "$count matches found.<br />";
}
The above code will output "2 matches found" no matter how many sets of tags there may be.