Ik krijg het maar niet voor elkaar, heb vanalles geprobeerd maar kan niet uitvinden waar het aan ligt 
wie heeft het verlossende antwoord?
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
| <? function phpReplace($txt) { ob_start(); highlight_string($txt); $txt = ob_get_contents(); ob_end_clean(); $txt = explode('<br />',$txt); for ($i = 1; $i < count($txt)+1; $i++) { $srcnums .= $i . "<br>"; } for ($i = 0; $i < count($txt); $i++) { $srclines .= $txt[$i] . "<br />"; } $src = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" class=\"phphighlight\"><tr><td class=\"phphighlightline\">" . $srcnums . "</td><td nowrap class=\"phphighlightcode\"><font color=\"#0000CC\"><code>" . $srclines . $txt[count($txt)] . "</code></font></td></tr></table>"; return $src; } $text = "[php]<? echo test; ?> [/php] hallo [php]hoi[/php]"; $regex = "!\\[php\](.*?)\\[\/php\]!ism"; preg_match_all($regex, $text, $output); for ($x = 0; $x < count($output[1]); $x++) { $text = str_replace($output[0][$x], phpReplace($output[1][$x]),$text); } echo '<link rel="stylesheet" href="got.css">'; $text = addslashes($text); $text = str_replace('\r\n', '<br />', $text); $text = str_replace('\r', '<br />', $text); $text = str_replace('\n', '<br />', $text); echo $text; ?> |

