开发者

Variable naming conventions with respect to their contents [closed]

开发者 https://www.devze.com 2023-03-07 14:41 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved a开发者_C百科nd possibly reopened, visit the help center for guidance. Closed 11 years ago.

I understand there's gazillions of questions pertaining to conventions. I couldn't find much, however, regarding some specifics that have always plagued me in my coding.

It comes down to filesystem and device representations, whether a handle/resource or path; what conventions are often followed to appropriately name variables containing such values/data?

More specifically I mean:

  • /path/to/resource/ A directory path ($dirpath)

  • (handle) A file handle/resource ($filehandle)

  • filename.php A file name ($filename)

  • /path/to/resource/filename.php A file path ($filepath)

If any of these are incorrect, please advise; concern over this may seem asinine, however I want to secure the understanding for myself, not to mention future colleagues.

Any directions to references/complete lists, or suggestions from your personal experience are more than welcome.

(marked it as PHP in case there are any language specific conventions I should know)


You're using pretty standard variable names there, so I don't think any php programmer would mistake those for something else.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号