PHP ver gevorderde |
|
... Deze vraag is zo vaak geweest...
Citaat: e
If this modifier is set, preg_replace() does normal substitution of backreferences in the replacement string, evaluates it as PHP code, and uses the result for replacing the search string. Single quotes, double quotes, backslashes and NULL chars will be escaped by backslashes in substituted backreferences.
Only preg_replace() uses this modifier; it is ignored by other PCRE functions.
Opmerking: This modifier was not available in PHP 3.
Dus het moet als volgt, aangezien je php wilt uitvoeren op het tweede argument.
$bericht = preg_replace('#\[code\](.*)\[/code\]#e', 'highlight_string("\\1")', $bericht);
$bericht = preg_replace('#\[code\](.*)\[/code\]#e', 'highlight_string("\\1")', $bericht);
|