Results 1 to 5 of 5

Thread: Looping

Threaded View

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Looping

    I have this code:

    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;
    }
    ?>
    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.

    However it just loops indefinetly and never catches more than one (code) tag.
    Last edited by The Hobo; Apr 26th, 2002 at 10:44 AM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width