> As I said, since I was recursing through the function by calling it numerous
> times in the middle of its execution, and since the function didn't
> explicitly return, I didn't expect it to continue past each call. That's
> all!
Sounds like you're coming in from CoBOL or maybe BASIC?
--
PHP
Ernest,
I'm not _that_ clueless :-)
As I said, since I was recursing through the function by calling it numerous
times in the middle of its execution, and since the function didn't
explicitly return, I didn't expect it to continue past each call. That's
all!
Martin
Ernest E Vogelsinger <[EMAIL
At 00:27 31.05.2003, Martin Helie said:
[snip]
>yes, I am familiar with these concepts; I am just starting to experiment
>with recursive functions and static variables. Thanks for explaining that
>once the function is called and completed, the rest of the fir
At 5/30/2003 06:27 PM, Martin Helie wrote:
> Thanks for explaining that once the function is called and
> completed, the rest of the first call continues executing
> normally. That is what surprised me.
Yup. It's what makes building function libraries a thing of art in PHP, you
can create smaller
Hi Steve,
yes, I am familiar with these concepts; I am just starting to experiment
with recursive functions and static variables. Thanks for explaining that
once the function is called and completed, the rest of the first call
continues executing normally. That is what surprised me.
Martin
> No.
At 5/30/2003 05:53 PM, Martin Helie wrote:
> 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
> Why? The "I'm here" line is outside the conditional. The function will
> still complete independent of the conditional. If $i is greater than ten,
> the pointer just skips the contents of the if/then and continues on the
> next line after it. Here's a better illustration:
In my test() function,
At 5/30/2003 04:49 PM, Martin Helie wrote:
> function test() {
> static $i = 0;
> if( $i < 10 ) {
> $i++;
> test();
> }
> echo "I'm here";
> }
>
> I am a little surprised to find that even when $i < 10 and test() is invoked
> again, the current function call execute
8 matches
Mail list logo