I will use "display_errors" as an example:
ini_set('display_errors', 1);// int
ini_set('display_errors', '1');// string
ini_set('display_errors', 'on');// string
ini_set('display_errors', true);// boolean
I know that all the above will work the same. I'm just curious to know what's the most proper one to use, if anyone knows.
On php.net the syntax looks like this:
string ini_set(string $varname, string $newvalue)
All parameters should be a string
. On the php.ini file all booleans shown as On
or Off
. The following solution should be the most proper solution:
ini_set('display_errors', 'On');
ini_set('display_errors', 'Off');
On the documentation of the configuration file you can find the following part:
Boolean values can be set to either:
true, on, yes or false, off, no, none
http://php.net/manual/en/configuration.file.php
On ini_get
the return value is a string. The documentation says:
A boolean ini value of off will be returned as an empty string or "0" while a boolean ini value of on will be returned as "1". The function can also return the literal string of INI value.
http://php.net/manual/en/function.ini-get.php
The return value of ini_get
and the value for ini_set
have to be a string!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With