I have this code:
Which searches through $crap to find all the (code) tags and replace what's between them with formatted text, like is done in these posts.PHP Code:<?php
include('snippets/format.php');
$crap = "Text!\n(code)Private Sub Form_Load()(/code)Text is cool!" . "\n(code)Dim strString As String(/code)";
if (strpos($crap, "(code)") == false) {
echo "no";
} else {
do {
$j = strpos($crap, "(code)");
if ($j == false) {
break;
}
$k = strpos($crap, "(/code)", $j);
$line = substr($crap, $j +6, $k - 12);
$code = $line; //format($line);
$crap = str_replace("(code)" . $line . "(/code)", $code, $crap);
} while ($j != false);
echo $crap;
}
?>
However it just loops indefinetly and never catches more than one (code) tag.




Reply With Quote