. , , , .
<?php
define('BIRD', 'Dodo bird');
$ini_array = parse_ini_file("sample.ini", true);
echo('<pre>'.print_r($ini_array,true).'</pre>');
?>
parse_ini_file.ini
[first_section]
one = 1
five = 5
animal = BIRD
[second_section]
path = "/usr/local/bin"
URL = "http://www.example.com/~username"
second_section[one]="1 associated"
second_section[two]="2 associated"
second_section[]="1 unassociated"
second_section[]="2 unassociated"
[third_section]
phpversion[] = "5.0"
phpversion[] = "5.1"
phpversion[] = "5.2"
phpversion[] = "5.3"
Output
Array
(
[first_section] => Array
(
[one] => 1
[five] => 5
[animal] => Dodo bird
)
[second_section] => Array
(
[path] => /usr/local/bin
[URL] => http:
[second_section] => Array
(
[one] => 1 associated
[two] => 2 associated
[0] => 1 unassociated
[1] => 2 unassociated
)
)
[third_section] => Array
(
[phpversion] => Array
(
[0] => 5.0
[1] => 5.1
[2] => 5.2
[3] => 5.3
)
)
)
source
share