RES: [PHP] 2 Questions: Static variables and the nature of the online manual

2008-03-04 Thread Thiago Pojda
 

-Mensagem original-
De: Svevo Romano [mailto:[EMAIL PROTECTED] 

Hi there,

Many thanks for your answer. I've also gone through your 
example and it took me 10 minutes to understand how the 
operator precedence was working there.
Was expecting 1 on the first call :)

But this is not the point. You've nailed my question very 
preciseley in your first answer: 'the preceding line is only 
run on the first call to the function'.

My only question is (at it is related to the nature of the 
online manual):
how do you know it and I don't? This thing is the only logical 
explanation to the fact the $a doesn't get initialized again to 
0 in any subsequent call to the function, but it's not written 
anywhere in the manual page. And it seems the most important 
statement in my opinion, that justifies what I see as an 
exception to a normal flow.

Hope all this makes sense.
Thanks,
S 



me
You can use http://bugs.php.net/report.php to report a documentation
bug and they'll change the docs :)

Thiago
/me



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: RES: [PHP] 2 Questions: Static variables and the nature of the online manual

2008-03-04 Thread Svevo Romano
Cheers Thiago,

In fact this was going to be my next question. I think I will report a
documentation bug, just because, after all the discussion we had today, I
realize that this is quite a common behaviour in other languages, but for
somebody new to languages, being them programming or scripting ones, the
fact that the $a=0 line doesn't get executed on subsequent calls isn't so
obvious.

In other words, from the standpoint of someone that is relatively new to the
details (at least), the flow is: 'ok, I do appreciate that the engine keeps
memory of the value of that variable declared as static after the function
ends, but assigning a value to it at the very beginning of the function
seems like the next time the function is going to be called, it will assaign
that value again and again...and again'.

And I guess the manual wants to be as clear as possible, considering that
the examples are often 'foo 'and '$a' related :P In other words I think that
it is indeed targeted to beginners as wel, isn't it?

Thanks for all the valuable info btw. :)

In 4/3/08 16:59, Thiago Pojda, [EMAIL PROTECTED] ha scritto

  
 
 -Mensagem original-
 De: Svevo Romano [mailto:[EMAIL PROTECTED]
 
 Hi there,
 
 Many thanks for your answer. I've also gone through your
 example and it took me 10 minutes to understand how the
 operator precedence was working there.
 Was expecting 1 on the first call :)
 
 But this is not the point. You've nailed my question very
 preciseley in your first answer: 'the preceding line is only
 run on the first call to the function'.
 
 My only question is (at it is related to the nature of the
 online manual):
 how do you know it and I don't? This thing is the only logical
 explanation to the fact the $a doesn't get initialized again to
 0 in any subsequent call to the function, but it's not written
 anywhere in the manual page. And it seems the most important
 statement in my opinion, that justifies what I see as an
 exception to a normal flow.
 
 Hope all this makes sense.
 Thanks,
 S 
 
 
 
 me
 You can use http://bugs.php.net/report.php to report a documentation
 bug and they'll change the docs :)
 
 Thiago
 /me
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php