[eluser]OliverHR[/eluser]
[quote author="n0xie" date="1286831764"]What use would declaring a variable have in a dynamic weak typed language?[/quote] Man I never say that, you Do
[quote author="n0xie" date="1286547958"]If you declare them at the top, you get the added bonus that your IDE will pick them up and will help you when using them.[/quote]
Even I think it is the right way no matter if php, vb6 an so... let to put variables in any place. what I say its if a variable its only used inside a method whay "Declare" it as a class property.
[quote author="n0xie" date="1286831764"]You use comments to declare class properties?[/quote]You are confused.
Anwser: No, I not, comment everything, but beacuse I forget to do.
But in my work I always must comment everything.(If I miss to comment my code, I could get fired)
Code:
...
/**
* example of documenting a variable's type
* @var string
*/
var $variable;
...
/**
* Bla, bla...
* @param datatype $paramname description
* return ...
*/
function do_some($paramname)
{
// some info that help
$othervar
return ...
}
???
As I say It is my point of view, I am not forcing you to do things like me.