Home > Backend Development > PHP Tutorial > How to Suppress PHP Strict Standards Errors: A Developer\'s Guide

How to Suppress PHP Strict Standards Errors: A Developer\'s Guide

Patricia Arquette
Release: 2024-11-21 16:08:14
Original
438 people have browsed it

How to Suppress PHP Strict Standards Errors: A Developer's Guide

Suppressing PHP Strict Standards Errors

When running PHP scripts, encountering strict standards errors can be frustrating. To alleviate this, PHP provides a way to disable these error messages, allowing for a cleaner development process.

Solution

There are two primary ways to disable strict standards errors:

  1. Disable Error Displaying:
ini_set('display_errors', '0');
Copy after login

This method prevents errors from being displayed to the user. However, it's recommended to log or otherwise record errors for debugging purposes.

  1. Logging Errors while Disabling Displaying:
ini_set('display_errors', '0');
error_reporting(E_ALL | E_STRICT);
Copy after login

This approach combines the above methods. It prevents error messages from being displayed, but still logs them for further analysis. This allows for a balance between a clean user interface and effective error tracking.

Note:

Disabling strict standards errors should only be considered a temporary solution for development or legacy code. It's generally advisable to address the underlying code issues to prevent these errors from occurring in the first place.

The above is the detailed content of How to Suppress PHP Strict Standards Errors: A Developer\'s Guide. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template