I need some help getting this script to run through my entire string and not stop on the first [ code ] tag.
- Code: Select all
$text = "<h1>PHP code incoming!</h1>
[code]\$testvar = \"Hejsan lol!<br /><br />\";
echo \"test<br />\";
echo \$testvar;[/code]
End of that! But wait?! :D
[code] echo \"MORE CODE!\"; [/code]";
$phpSegment = explode("[code]", $text);
$htmlSegment1 = $phpSegment[0];
$phpSegment = explode("[/code]", $phpSegment[1]);
$phpSegmentCode = $phpSegment[0];
$htmlSegment2 = $phpSegment[1];
echo $htmlSegment1;
echo eval("$phpSegmentCode");
echo $htmlSegment2;

