At 9:32 AM -0800 1/26/01, Brandon Orther wrote:
>Hello,
>
>I am doing a do loop and I want it to change what variable to use each
>run...
>
>First time use: $run1
>
>Second time use: $run2
>
>Third time use: $run2
>
>I hope you can understand what I am saying.
>


'Variable variables'; see

        http://www.php.net/manual/en/language.variables.variable.php

If you meant $run3 on the third time line, then you can use

        for ($i=1; $i<$SomeNumber; $i++)
        {
        $SomeValue = some_function(${run$i});
        }

Or, use could say

        for ($i=1; $i<$SomeNumber; $i++)
        {
        $VarName = "run$i";
        $SomeValue = some_function($$VarName);
        }

If you actually _wanted_ to use '$run2' on the third time, I'm 
interpreting that to mean you want to limit the maximum value of the 
digit to 2. If so, you could do

        for ($i=1; $i<$SomeNumber; $i++)
        {
        $VarName = 'run'.max($i, 2);
        $SomeValue = some_function($$VarName);
        }


-Steve


>--------------------------------------------
>Brandon Orther
>WebIntellects Design/Development Manager
>[EMAIL PROTECTED]
>800-994-6364
>www.webintellects.com
>--------------------------------------------


-- 
+--- "They've got a cherry pie there, that'll kill ya" ------------------+
| Steve Edberg                           University of California, Davis |
| [EMAIL PROTECTED]                               Computer Consultant |
| http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
+-------------------------------------- FBI Special Agent Dale Cooper ---+

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to