function bb_parse($string) {
while (preg_match_all('`\[(.+?)=?(.*?)\](.+?)\[/\1\]`', $string, $matches)) foreach ($matches[0] as $key => $match) {
list($tag, $param, $innertext) = array($matches[1][$key], $matches[2][$key], $matches[3][$key]);
switch ($tag) {
case 'quote': $replacement = "<blockquote>$innertext</blockquote>" . $param? "<cite>$param</cite>" : ''; break;
}
$string = str_replace($match, $replacement, $string);;
}
return $string;
}
So what I expected is that when give the function something like
"[quote=name]quote[/quote]" //it would output "<blockquote>$innertext</blockquote> <cite>name</cite>" //but instead it only returns "<cite>name</cite>" //when a parameter is present
does anybody see where the error is at, ive played around with the code and cant figure out whats wrong with it

New Topic/Question
Reply




MultiQuote





|