Jump to content

which is lighter variable or constant?


DanDaBeginner

Recommended Posts

A variable is simply a pointer to the memory where the actual variable contents are stored, the same with a constant, the only difference being that a constant can't be changed. It depends on what you're script is being used for, if it's being used alot then constants are to be avoided as php creates a new instance in the memory for each constant every time the script is run; for example if the script is accessed 5 times at the same time you end up with 5 constants in the memory. Not too sure how variables work in the same level of detail.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.