|
mystic@de4th.com , again - 07 Sep 2008
Sorry..
In my opinion, the first is more legible and the usage of multiple variables
should be
In my opinion, the first is more legible and the usage of multiple variables *of the same name*
mystic@de4th.com - 07 Sep 2008
I wouldn't consider it so much a bad programming habit when used in the context of functions. For example, I find it handy to use multiple $a's, $b's, etc within my functions because it's an easier and faster method of computing. Like the following:
function myFun($a,$b,$c) //higher num, lower num, exponent
{
$result = round(pow(($a / $b),$c));
return $result;
}
compared to:
function myFun($high,$low,$expo)
{
$result = round(pow(($high / $low),$expo));
return $result;
}
In my opinion, the first is more legible and the usage of multiple variables can be justified when comments are supplied to explain what said variables are. This allows multiple functions to use the same variables and improve readability, thanks to their small scope. It would be a pain naming every dynamic variable something different.
A PHP User - 07 Sep 2008
Perhaps this is true but why would you want to encourage bad programming habits?
Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.
If you are reporting an error in the content, please tell me directly.
|