Help PHP QUESTION!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Direktor
    Registered User
    • Dec 2001
    • 529

    #1

    Help PHP QUESTION!

    My code:

    <?php
    $xi = "x";
    for ($i = 1; $i < 400; ++$i) {
    echo ("$xi.$i");
    ?>


    I know its wrong.. but how do I go about if I want to:

    echo $x1 to $x400


  • Jade
    Confirmed User
    • Jun 2001
    • 329

    #2
    /* example 1 */

    for ($i = 1; $i <= 10; $i++) {
    print $i;
    }

    /* example 2 */

    for ($i = 1;;$i++) {
    if ($i > 10) {
    break;
    }
    print $i;
    }

    /* example 3 */

    $i = 1;
    for (;;) {
    if ($i > 10) {
    break;
    }
    print $i;
    $i++;
    }

    /* example 4 */

    for ($i = 1; $i <= 10; print $i, $i++);

    Cum see me at http://BlowjobJade.com

    Comment

    • Lane
      Will code for food...
      • Apr 2001
      • 8496

      #3
      for ($i=1;$i<401;$i++) {eval("echo \$x$i;");}

      Comment

      • Direktor
        Registered User
        • Dec 2001
        • 529

        #4
        very close, but is not printing out anything if I do this for example...


        www.mydomain.com/thescript.php?x330=hello

        or

        www.mydomain.com/thescript.php?x330=hello&x331=bye&x400=cya

        see where im heading?

        Last edited by Direktor; 01-28-2002, 11:27 PM.

        Comment

        • Direktor
          Registered User
          • Dec 2001
          • 529

          #5
          nevermind, it works

          now just need to figure out how to add " " and ", "

          after each $x


          Comment

          • Lane
            Will code for food...
            • Apr 2001
            • 8496

            #6
            can you give and example input/output ?

            Comment

            • Theo
              HAL 9000
              • May 2001
              • 34515

              #7
              sure

              Input:Equinox
              Output:Gay

              is this valid output?

              Comment

              • awechen
                Confirmed User
                • Oct 2001
                • 162

                #8
                PHP Code:
                <?
                $couner = "123";
                for ($i=0;$i<$counter;$i++)
                {
                print "now $i  left ".($i-$couner)."\n";
                }
                ah you have been blessed with 72 virgins?

                Comment

                • Direktor
                  Registered User
                  • Dec 2001
                  • 529

                  #9
                  well output?


                  ok, hello, hi, fuck you!, welcome back, number of posts, etc.

                  Comment

                  Working...