What settings should be changed while setting up php WAMP so that undefined variable error are not encountered?
I changed the setting register_globals = on
but it did not help.
What settings should be changed while setting up php WAMP so that undefined variable error are not encountered?
I changed the setting register_globals = on
but it did not help.
You are probably looking for this php.ini
setting:
error_reporting = error_reporting = E_ALL & ~E_NOTICE
it should be the default setting in a fresh install, though.
The best way, however, is always to change your scripts so undefined variable
notices aren't thrown in the first place.
Notices sometimes contain valuable information that is impossible to find in a sea of meaningless "undefined variable" notices; and even if notices and warnings are suppressed, they slow down the script's execution! So the right thing is to prevent them from the start if at all possible.
You can check for the existence of each variable using isset()
or empty()
before using it to prevent undefined variable
notices from happening.