I’m trying to write my code as maintainable and easy to understand as possible, and I thought of including the type of data a variable holds in its name.
e.g:
$intCurrentLine = 1; instead of $currentLine = 1;
$strUser = 'blah'; instead of $user = 'blah';
I don’t think it is really necessary in the above example, but may it be helpful in some cases?
- Could this make my code more understandable?
- Should I actually use this or stick with “normal” variable names?
- Do you know scripts where this is used?
best regards,
lamas
Adding the type to the name of the variable is called Hungarian Notation.
It’s a matter of style in typeless languages such as PHP and VB. I prefer not to use because there isn’t a real need.
This is a good article on the topic. http://www.joelonsoftware.com/articles/Wrong.html