How to hide warnings and notices in php

178 views   Web Development  2020.07.04


I have my site running and I've been trying to make some updates on codes, but I got notices and warnings, And I want to know how can I silence/disable them only but excluding other types of errors because I don't want to let my site looks bad while I'm removing bugs

Answers, ideas and Comments

» 2 ideas

jeph6 • 1 year ago
Warning error only warns you if there is any problem in the script, And you better remove it as soon as possible in order to avoid issues in future. But if you are still fighting to remove bugs in your program It's sometimes necessary to hide errors from users(for instance: you might be trying to remove errors on hosted site) As we know Since you have This type of error, Your codes will run but with warning on the next line Notice error will occur since you are trying to have access to undefined function or variable and similarly it won't stop your codes from execution and running. »

0 



gadrawin • 1 year ago
Before hiding notices or warnings, You have to know what you are being warned for. as you can see warnings cannot prevent your program (script) from running but appear in order to notify something wrong with your codes, Even if it will let other block of your program run as usual, hide it in order to make the site look as usual, but don't forget that there's issues behind the scenes. Write this: error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE); Or error_reporting(E_ALL ^ E_WARNING); That means it will disable all other errors except warnings  »

0 



In order to go deep, share any relevant idea or posting solution to some questions, You have to sign in or create a new account if you don't have one. And get Donnekted(connected)




Log in now  Join the Team

This site is for sharing topics, questions, answers, experiences or other contents related to different stuffs, especially technology. For existing users, They can make any topic(post) to discuss about in hope for ideas or any result from other people from different communities. In order to get involved, Get donnekted(connected) by Joining us here!