> In my test() function, I called test() again inside the if statement (which > checks true for 10 iterations)
Yes. So you've called the statement 10 times.
> and I thought that the current function would immediately be terminated > by calling itself (or any other function that doesn't return) again
Why would you think this? Once whatever function is called terminates, the parent function will resume, which means that once the spawned version of the function is done, the original will resume. The difference here is that the child instances inherit the value of $i because you've made it static.
> and never actually echo "I'm here" until the condition wasn't met, therefore > the function not called again. > > No?
No. I told you, that "I'm here" is going to execute any time you call that function because it's OUTSIDE the if statement. Only statements inside the if are affected by its conditional. Once the pointer gets to the if, it's going to check the conditional and, if it's true, as it is the first 10 times you go through the function, then it will run whatever's inside. If it's not true, the pointer will look for an else statement to execute, and then resume running all of the other lines in the function. If you want a block of code to not run until the conditional is false, then you want to use an ELSE statement, you don't want to just drop your code after your if, it doesn't work that way.
I suggest reading up more on user-defined functions and what terminates them
http://www.php.net/manual/en/functions.php#functions.user-defined
And if/then statements
http://www.php.net/manual/en/control-structures.php#control-structures.if -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php