I recently setup a new web server and I'm getting undefined variable error. If I use variables without initializing, it gives me an error. The source code did not change. Only the LAMP environment did. How would you solve this problem?
Thanks
Well...
You should define all your variables, those warnings are there for a reason, to make you code better. Undefined variables can easily lead to typo errors in variable names.
You can change the *error_reporting* level, above E_NOTICE to get rid of that, but it is highly unadvisable.
You can set notices to not show.
error_reporting(E_ALL & ~E_NOTICE)
You should be developing with
error_reporting(E_ALL | E_STRICT)
you can change your error_reporting as people said, but if you want keep the default error_reporting configuration. you may use @
operator. e.g: @$post
精彩评论