0

Im looking forward making conditional that checks if display_errors in php (on any level, simply yes or no) is on or off in if statement.

Is there any way to do this?

edit: this question is about checking status of display_errors but not how to set it on and off. its something diffrent.

Gall Annonim
  • 153
  • 9

1 Answers1

3
echo 'display_errors = ' . ini_get('display_errors') . "\n";

Output:

display_errors = 1

Or

display_errors = 0

Ref: http://php.net/manual/en/function.ini-get.php

Naga
  • 2,160
  • 3
  • 14
  • 21
  • Note: to be clear, the 0 and 1 output were numeric strings."0" and "1". var_dump (ini_get ('directive')) is less ambiguous and might help you decide how to test. Also, 0 and 1 understates the galaxy of ini_get return values if a directive was set in runtime. eg. `ini_set('display_errors', 'True');` or even `'yEs', 'oN', 'tRuE'` – DWB May 06 '21 at 22:17