PHP preg_replace
Visa första olästa |
| #1 | |
|
Flitig postare
| Tjenna. Denna kod funkar:
echo preg_replace ('/\<code\>(.*?)\<\/code\>/isx', '<pre class="code">$1</pre>', $content); Men jag vill kunna sätta htmlentities($1) på koden som är inuti <code>. preg_replace funkar men hur sätter jag funktionen på den? |
| #2 | |
|
Flitig postare
|
CODE echo preg_replace ('/\<code\>(.*?)\<\/code\>/isxe', "'<pre class=\"code\">'.htmlentities('$1').'</pre>'", $content);Glöm inte pattern-modifiern /e (PREG_REPLACE_EVAL). |
| #3 | ||
|
Flitig postare
|
Citat:
Hmm, vad gör EVAL? Låter den dig ha php kod i replace-taggen? Senast redigerad av frecka den 2011-11-24 klockan 13:35. | |
| #4 | |
|
Mycket flitig postare
|
Exakt
(utfyllnad...) |
Aktiva användare som för närvarande tittar på det här ämnet: 0 (0 medlemmar och 0 gäster)

Visa första olästa
