How to display/hide strict/all errors in php?

If you need to display all php errors on the web-page before production, you can use it settings
For display ALL errors/notices/warnings/deprecated info:
If you have access to php.ini then you can change 2 params.
Example (in php.ini) ↓

error_reporting = E_ALL
display_errors = On

Often, you need to check a separate part of functional and you don’t want display errors on the all site.
In this way, you can insert 2 lines in your php file with debug functional.
Example ↓

//Show all errors, notices
ini_set('display_errors', 1);

Note: Display errors could be turned off in the php.ini or your Apache config file.

Turn off all error reporting

ini_set('display_errors', 0);

// but, recommended log errors
log_errors = on
error_log = /path/to/logs/php_error.log

Also, you can use different error-level constants:
E_ALL – All errors and warnings (includes E_STRICT as of PHP 6.0.0)
E_ERROR – fatal run-time errors
E_RECOVERABLE_ERROR – almost fatal run-time errors
E_WARNING – run-time warnings (non-fatal errors)
E_PARSE – compile-time parse errors
E_NOTICE – run-time notices (these are warnings which often result from a bug in your code, but it’s possible that it was intentional (e.g., using an uninitialized variable and relying on the fact it’s automatically initialized to an empty string)
E_STRICT – run-time notices, enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code
E_CORE_ERROR – fatal errors that occur during PHP’s initial startup
E_CORE_WARNING – warnings (non-fatal errors) that occur during PHP’s initial startup
E_COMPILE_ERROR – fatal compile-time errors
E_COMPILE_WARNING – compile-time warnings (non-fatal errors)
E_USER_ERROR – user-generated error message
E_USER_WARNING – user-generated warning message
E_USER_NOTICE – user-generated notice message
E_DEPRECATED – warn about code that will not work in future versions of PHP
E_USER_DEPRECATED – user-generated deprecation warnings

Common Values:

E_ALL & ~E_NOTICE – Show all errors, except for notices and coding standards warnings.
E_ALL & ~E_NOTICE | E_STRICT – Show all errors, except for notices.
E_ALL | E_STRICT – Show all errors, warnings and notices including coding standards.

Default Value: E_ALL & ~E_NOTICE
Development Value: E_ALL | E_STRICT
Production Value: E_ALL & ~E_DEPRECATED

Examples (inline php file) ↓

// Default. Show all errors, except for notices and coding standards warnings
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', 1);

// Development. Show all errors, except for notices
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);

// Production. Show all errors, except for notices about deprecated methods
error_reporting(E_ALL & ~E_DEPRECATED);
ini_set('display_errors', 1);