note 72277 modified in function.get-cfg-var by danbrown
| From: | danbrown@php.net | Date: | Sat, 19 Jul 2008 23:44:38 +0000 |
| Subject: | note 72277 modified in function.get-cfg-var by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141802@lists.php.net to get a copy of this message | ||
Regarding the statement by the earlier poster that:
"Unfortunately, you almost never want to know the original value in the config file. Instead,
you want to know the value currently in effect."
I have found this useful for changing the error reporting levels for a few specific pages while
testing. I turn on all error_reporting while testing, but for a few pages I want to turn off
notices. So, I put this at the top of the page:
<?php
error_reporting(8183);
?>
and this at the bottom:
<?php
error_reporting(get_cfg_var('error_reporting'));
?>
to put it back to whatever default I had at the time.
--was--
Regarding the statement by the earlier poster that:
"Unfortunately, you almost never want to know the original value in the config file. Instead,
you want to know the value currently in effect."
I have found this useful for changing the error reporting levels for a few specific pages while
testing. I turn on all error_reporting while testing, but for a few pages I want to turn off
notices. So, I put this at the top of the page:
error_reporting(8183);
and this at the bottom:
error_reporting(get_cfg_var('error_reporting'));
to put it back to whatever default I had at the time.
http://php.net/manual/en/function.get-cfg-var.php