But in production environment displaying Notice messages is not a good practice.
We need to disable them in production environment.
For doing this,we can set php.ini file setting as below,
error_reporting = E_ALL & ~E_NOTICE
It will allow to display all error messages (fatal,warning,parse) except the Notice type error.
If you are not sure about php.ini file location, use phpinfo() to find the location/path of the php.ini file.
Or alternatively, we can use "@" modifier before the variable name to suppress the Notice message related to that variable.