Home  >  Article  >  Backend Development  >  What is the usage of php ini_set

What is the usage of php ini_set

藏色散人
藏色散人Original
2021-09-02 10:12:582542browse

php The ini_set function is to set the value for a configuration option. Its usage syntax is "ini_set(string $varname, string $newvalue): string".

What is the usage of php ini_set

The operating environment of this article: Windows7 system, PHP7.1 version, Dell G3 computer

What is the usage of php ini_set?

php ini_set - Set the value for a configuration option

Description

ini_set(string $varname, string $newvalue): string

Set the value of the specified configuration option. This option will retain its new value while the script is running, and will be restored when the script ends.

Parameter varname: Not all valid options can be changed with ini_set(). There is an appendix with a list of valid options.

newvalue: The new value of the option.

Return value: Return the old value on success, return false on failure.

Example:

Set an ini option

<?php
echo ini_get(&#39;display_errors&#39;);
if (!ini_get(&#39;display_errors&#39;)) {
    ini_set(&#39;display_errors&#39;, &#39;1&#39;);
}
echo ini_get(&#39;display_errors&#39;);
?>

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What is the usage of php ini_set. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn