Allen Shaw wrote:
But the temporary variables used within a function or method are usually only relevant in the lines where they're being used. Document them where you use them, and save yourself the nightmare of keeping a single comprehensive doc-block up to date.

That is indeed a pretty good argument and I will let it sink for a while, but I can't come up with any disadvantages to that.

Allen also wrote "Again, it totally depends on the logical flow of your scripts". Why/when would the location of variable definitions depend on the logical flow of the script?
If he needs to use that value in the beginning of his script, he'll have to define it there. Where it's used is determined by how he wants the script to work. I still recommend defining/initializing/documenting it as close as possible to the place it's used.

Oh, ok, that is what you meant.


Thanks for the response, very helpful.


David
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to