note 84886 modified in function.parse-ini-file by danbrown
| From: | danbrown@php.net | Date: | Sun, 23 Jan 2011 17:09:28 +0000 |
| Subject: | note 84886 modified in function.parse-ini-file by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176154@lists.php.net to get a copy of this message | ||
Here is another way to group values in the ini:
my.ini:
[singles]
test = a test
test2 = another test
test3 = this is a test too
[multiples]
tests[] = a test
tests[] = another test
tests[] = this is a test too
my.php:
<?php $init = parse_ini_file('my.ini'); ?>
The same as:
<?php
$init['test'] = 'a test';
$init['test2'] = 'another test';
$init['test3'] = 'this is a test too';
$init['tests'][0] = 'a test';
$init['tests'][1] = 'another test';
$init['tests'][2] = 'this is a test too';
?>
This works with the bool set to true also, can be useful with loops. Works with the bool set to true
as well.
--was--
Here is another way to group values in the ini:
my.ini:
[singles]
test = a test
test2 = another test
test3 = this is a test too
[multiples]
tests[] = a test
tests[] = another test
tests[] = this is a test too
my.php:
$init = parse_ini_file('my.ini');
The same as:
$init['test'] = 'a test';
$init['test2'] = 'another test';
$init['test3'] = 'this is a test too';
$init['tests'][0] = 'a test';
$init['tests'][1] = 'another test';
$init['tests'][2] = 'this is a test too';
This works with the bool set to true also, can be useful with loops. Works with the bool set to true
as well.
http://php.net/manual/en/function.parse-ini-file.php