first of all i have this code
function Huemix_content_filter_qm($content){
$item = '\?';
$before='<span class="kindared">';
$after='</span>';
$content = preg_replace("|($item)|","$before$1$after",$content);
$content = preg_replace("|(<[^>]+?)($before($item)$after)([^<]+?>)|","$1$3$4",$content);
return $content;
}
add_filter('the_content', 'Huemix_content_filter_qm');
i can under stand the whole code but this three vars $1$3$4
can any one tell me what they are, cuz as i did i never define them !
From the manual:
replacement may contain references of the form or (since PHP 4.0.4) $n, with the latter form being the preferred one. Every such reference will be replaced by the text captured by the n'th parenthesized pattern. n can be from 0 to 99, and \0 or $0 refers to the text matched by the whole pattern. Opening parentheses are counted from left to right (starting from 1) to obtain the number of the capturing subpattern. To use backslash in replacement, it must be doubled ("\\" PHP string).
Basically each one represents a match in parenthesis in the regex. The number represents which match it is. $1
represents what is matched with (<[^>]+?)
, $3
matches ($item)
, and $4
matches ([^<]+?>)
.