-1

Can anyone tell me the purpose of using the ini_set function in PHP ?

ini_set('display_errors', 'On');

Above is the code that they have used.

Thanks

Masivuye Cokile
  • 4,723
  • 3
  • 16
  • 33
  • 1
    it will try to output errors to screen. Its worth mentioning this may not always work if have opposing code in application config. Additionally, other code is sometimes required before errors are output. – atoms Nov 06 '17 at 10:02
  • 1
    check this: https://stackoverflow.com/questions/25759947/whats-the-purpose-of-ini-set-in-php-especially-for-error-reporting – MD Ruhul Amin Nov 06 '17 at 10:03
  • https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display – Masivuye Cokile Nov 06 '17 at 10:07

2 Answers2

0

As php documentation:

ini_set — Sets the value of a configuration option

Purpose:

string ini_set ( string $varname , string $newvalue )

Sets the value of the given configuration option. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending.

You can override your config file's value via this method. Suppose in your php.ini file, error reporting is configured to false. And for this particular request you want to report error. By using this method you can turn on this error reporting feature. Hope you understand.

MD Ruhul Amin
  • 3,861
  • 1
  • 17
  • 32
0

ini_set Sets the value of a configuration option(php.ini)

Your statement will be used for displaying errors, if you will set it to Off or 0 then it will not display errors.

readmore

Aiyaz Khorajia
  • 558
  • 2
  • 10