ini_set

(PHP 4, PHP 5, PHP 7, PHP 8)

ini_setSets the value of a configuration option

Description

ini_set(string $option, string|int|float|bool|null $value): string|false

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.

Parameters

option

Not all the available options can be changed using ini_set(). There is a list of all available options in the appendix.

value

The new value for the option.

Return Values

Returns the old value on success, false on failure.

Changelog

Version Description
8.1.0 value now accepts any scalar type (including null). Previously, only string values were accepted.

Examples

Example #1 Setting an ini option

<?php
echo ini_get('display_errors');

if (!
ini_get('display_errors')) {
ini_set('display_errors', '1');
}

echo
ini_get('display_errors');
?>

See Also