Typed
Values from ini
Files
Already introduced in PHP 5.6.1, the
INI_SCANNER_TYPED
constant can be used to enable the
parse_ini_file()
and parse_ini_string()
functions to return typed values from ini
files:
var_dump(
parse_ini_string(
'setting=1',
false,
INI_SCANNER_TYPED
)
);
array(1) {
["setting"]=>
int(1)
}
This functionality will now come in handy when passing values
that are read from ini
files to functions or methods
that use scalar type declarations in their parameter list.