jayshields wrote:I agree with the "much ado about nothing" points. Especially in the case of PHP where variables can change their types freely. Another reason why PHP is poor ground for Hungarian notation is functions like array_search() which return "mixed".
My feeling on this is that something is better than nothing. I mean, look at these variables:
$result
$compoundAverage
$msgs
Let's say you're joining a project and they don't have time to tell you everything about the code you'll be inheriting, and have a tight deadline. Wouldn't it be easier for you if you knew what kinds of things were stored in those variables without having to dump them out with die() or var_dump()?
On the mixed item, I use either $mixed or $vResult to indicate it's a mixed result. The "v" means variant or any/mixed. However, I don't let the value sit in $mixed forever -- I convert it to something as I might understand the context or might be able to apply a condition on $mixed, and thus I would be back to my lightweight Hungarian again as something like $sResult (string) or $asItems (array of strings) or $aoItems (array of objects).
And Hungarian doesn't have to be tough -- that's why I came up with a lightweight Hungarian. And in fact, I'm not the only one -- I recently viewed an interactive chat product sold from a guy in Brazil. I cracked open the source and was surprised to see almost my exact same notation used on variables, even with things like $asItems or $aoItems.
So, to me, it isn't a case of
nothing here, but
something, and that something is
clarity. Ask a programmer what his biggest problems are and in the top 5 on that list will be "meeting deadlines". So, with a simple extra keystroke per variable name you help some small amount, then I think it's worth it.