Jump to content

Nulling variables if they don't exist - why bother?


psyickphuk

Recommended Posts

Well I know why, if I don't then I get a variable is undefined message.

 

It just seems such a pain to me, for example I have a big long list for each submitted form field like:

 

if (!isset($E_Email)){$E_Email= null;}

 

Is there a way of just enabling this for every variable by default?

 

 

In most other languages you have to define the variable for you to use them. It is good practice and ensures that the variable will contain what you expect it to.

 

Security reasons is probably the main reason, but it also helps the server out since it will not search all variables and find out that one is not there, it sees it and returns it.

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.