Reputation: 477
I have an .ini
file. This is what an .ini
file looks like:
[something]
a = b
c = d
e = f
g = h
I have the following PHP code:
$ini = parse_ini_file("data.ini", true);
print_r($ini);
The output is:
Array
(
[something] => Array
(
[a] => b
[c] => d
[e] => f
[g] => h
)
)
Is there a way to 'decode' the array? For example, that the output is this:
a => b
c => d
e => f
g => h
Thanks!
Upvotes: 0
Views: 118
Reputation: 7251
Like this :
$ini = parse_ini_file("data.ini", true);
foreach ($ini['something'] as $key => $value) {
echo $key . " => ". $value."<br />";
}
OUTPUT
a => b
c => d
e => f
g => h
Upvotes: 4
Reputation: 5147
Its same as mentioned in php page
<?php
$fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');
reset($fruit);
while (list($key, $val) = each($fruit)) {
echo "$key => $val\n";
}
?>
Upvotes: 0