views:

260

answers:

4

When it comes to cookies and PHP, what naming style do you use?

Here are a few styles I can think of:

  • lower_case
  • camelCase
  • UPPER_CASE
+4  A: 

appname_meaningfulname

Ignacio Vazquez-Abrams
A: 

I use whatever style the coding standards for the project call for.

Generally I prefer camelCase for naming schemes, but whichever one pays the bills is the one I'll go with.

zombat
+2  A: 

Maybe you won't like my answer:

Don't use your own cookies but store data in server sessions. So you only need one cookie (to reference the session id) and how you name that plays no role.

NineBerry
+2  A: 

Keep in mind that this cookie is sent with every request, so imho, just use the smallest name you can, and document your code nicely.

MatthieuP