psyickphuk Posted December 4, 2008 Share Posted December 4, 2008 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? Link to comment https://forums.phpfreaks.com/topic/135535-nulling-variables-if-they-dont-exist-why-bother/ Share on other sites More sharing options...
premiso Posted December 4, 2008 Share Posted December 4, 2008 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. Link to comment https://forums.phpfreaks.com/topic/135535-nulling-variables-if-they-dont-exist-why-bother/#findComment-706063 Share on other sites More sharing options...
Mchl Posted December 4, 2008 Share Posted December 4, 2008 If you're not concerned about reasons premiso gave you, you can just disable notices using error_reporting Link to comment https://forums.phpfreaks.com/topic/135535-nulling-variables-if-they-dont-exist-why-bother/#findComment-706083 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.