4 ms·
$data is a perfectly fine variable name, if it's used in the correct context. Such as pulling a result set out of a database. In that case, it's exactly like us
by mseebach 17y ago
$data is a perfectly fine variable name, if it's used in the correct context. Such as pulling a result set out of a database. In that case, it's exactly like using i in a for loop.
Anything postfixed with 2 is more shady, I agree, but the absolute worst variable names are the ones that say they are something they're not - such as a column named "tablename_key" - which is actually a foreign key, but not in "tablename".
- roundsquare 17y agoSuch as pulling a result set out of a database. Generally, I'd disagree, as does the article. If you can specify what kind of data it is, thats useful. customer_data, sample_data, etc... The only time I'd say you might be right is if you are using it in a generic method for retrieving data, but even then I think result_data is better.