Is it bad practice for a class to have a variable and method of the same name?
Well, it's a matter of opinion what is and isn't bad practice, but
personally I would never give a variable and a function the same name
- if only to avoid confusion (PHP shouldn't mind if you do so though).
Paul
--
Is it bad practice for a class to have a variable and method of the same name?
For example:
class product {
var $Name;
function Name() {
return stripslashes($this-Name);
}
}
Thanks,
-Ed
This message was
2 matches
Mail list logo